diff --git a/ddtrace/appsec/_iast/_ast/ast_patching.py b/ddtrace/appsec/_iast/_ast/ast_patching.py index 3a80c3372b3..41ad1467793 100644 --- a/ddtrace/appsec/_iast/_ast/ast_patching.py +++ b/ddtrace/appsec/_iast/_ast/ast_patching.py @@ -58,7 +58,7 @@ "protobuf", "pycparser", # this package is called when a module is imported, propagation is not needed "pytest", # Testing framework - "request", # JJJ remove + "requests", # JJJ remove "setuptools", "sklearn", # Machine learning library "tomli", @@ -213,18 +213,16 @@ def astpatch_module(module: ModuleType, remove_flask_run: bool = False) -> Tuple log.debug("empty file: %s", module_path) return "", "" - # JJJ retry3 - return module_path, source_text - # if remove_flask_run: - # source_text = _remove_flask_run(source_text) - - # new_source = visit_ast( - # source_text, - # module_path, - # module_name=module_name, - # ) - # if new_source is None: - # log.debug("file not ast patched: %s", module_path) - # return "", "" - # - # return module_path, new_source + if remove_flask_run: + source_text = _remove_flask_run(source_text) + + new_source = visit_ast( + source_text, + module_path, + module_name=module_name, + ) + if new_source is None: + log.debug("file not ast patched: %s", module_path) + return "", "" + + return module_path, new_source diff --git a/ddtrace/appsec/_iast/_loader.py b/ddtrace/appsec/_iast/_loader.py index 8ea73283943..f211191430b 100644 --- a/ddtrace/appsec/_iast/_loader.py +++ b/ddtrace/appsec/_iast/_loader.py @@ -13,7 +13,6 @@ def _exec_iast_patched_module(module_watchdog, module): - # JJJ patched_source = None compiled_code = None if IS_IAST_ENABLED: @@ -29,7 +28,7 @@ def _exec_iast_patched_module(module_watchdog, module): compiled_code = compile(patched_source, module_path, "exec") except Exception: log.debug("Unexpected exception while compiling patched code", exc_info=True) - # compiled_code = None + compiled_code = None if compiled_code: # Patched source is executed instead of original module