From 42f4fd6552f71be92afbb954c186f41d2ccf4837 Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Wed, 24 Jul 2024 18:50:31 +0200 Subject: [PATCH] test: astpatch and compile but run the original module Signed-off-by: Juanjo Alvarez --- ddtrace/appsec/_iast/_loader.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ddtrace/appsec/_iast/_loader.py b/ddtrace/appsec/_iast/_loader.py index 8e0e1b28c3b..8eaecdcb147 100644 --- a/ddtrace/appsec/_iast/_loader.py +++ b/ddtrace/appsec/_iast/_loader.py @@ -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: @@ -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)