Skip to content

Commit

Permalink
undo commented code
Browse files Browse the repository at this point in the history
Signed-off-by: Juanjo Alvarez <[email protected]>
  • Loading branch information
juanjux committed Jul 25, 2024
1 parent 8c4b0d6 commit 79ce71f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
30 changes: 14 additions & 16 deletions ddtrace/appsec/_iast/_ast/ast_patching.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
3 changes: 1 addition & 2 deletions ddtrace/appsec/_iast/_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


def _exec_iast_patched_module(module_watchdog, module):
# JJJ
patched_source = None
compiled_code = None
if IS_IAST_ENABLED:
Expand All @@ -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
Expand Down

0 comments on commit 79ce71f

Please sign in to comment.