Skip to content

Commit

Permalink
test: astpatch and compile but run the original module
Browse files Browse the repository at this point in the history
Signed-off-by: Juanjo Alvarez <juanjo.alvarezmartinez@datadoghq.com>
  • Loading branch information
juanjux committed Jul 24, 2024
1 parent 5f2688a commit 42f4fd6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ddtrace/appsec/_iast/_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@


def _exec_iast_patched_module(module_watchdog, module):
# JJJ
module_watchdog.loader.exec_module(module)
return # JJJ
patched_source = None
compiled_code = None
if IS_IAST_ENABLED:
Expand All @@ -33,13 +30,16 @@ def _exec_iast_patched_module(module_watchdog, module):
log.debug("Unexpected exception while compiling patched code", exc_info=True)
compiled_code = None

if compiled_code:
# Patched source is executed instead of original module
exec(compiled_code, module.__dict__) # nosec B102
elif module_watchdog.loader is not None:
try:
module_watchdog.loader.exec_module(module)
except ImportError:
log.debug("Unexpected exception on import loader fallback", exc_info=True)
else:
log.debug("Module loader is not available, cannot execute module %s", module)
# JJJ
module_watchdog.loader.exec_module(module)
return
# if compiled_code:
# # Patched source is executed instead of original module
# exec(compiled_code, module.__dict__) # nosec B102
# elif module_watchdog.loader is not None:
# try:
# module_watchdog.loader.exec_module(module)
# except ImportError:
# log.debug("Unexpected exception on import loader fallback", exc_info=True)
# else:
# log.debug("Module loader is not available, cannot execute module %s", module)

0 comments on commit 42f4fd6

Please sign in to comment.