diff --git a/Dockerfile b/Dockerfile index 02910a78..77125129 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,8 +25,11 @@ RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_taint_tracki RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_stacktrace*.so # _stack_v2 may not exist for some versions of ddtrace (e.g. under python 3.13) RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/stack_v2/_stack_v2.*.so -# remove *.dist-info directories except any entry_points.txt files -RUN find ./python/lib/$runtime/site-packages/*.dist-info -not -name "entry_points.txt" -type f -delete +# remove *.dist-info directories except any entry_points.txt files and METADATA files required for Appsec Software Composition Analysis +RUN find ./python/lib/$runtime/site-packages/*.dist-info \ + -type f \ + ! \( -name 'entry_points.txt' -o -name 'METADATA' \) \ + -delete RUN find ./python/lib/$runtime/site-packages -type d -empty -delete # Remove requests and dependencies diff --git a/datadog_lambda/__init__.py b/datadog_lambda/__init__.py index f319d2ed..0166f077 100644 --- a/datadog_lambda/__init__.py +++ b/datadog_lambda/__init__.py @@ -3,7 +3,10 @@ if os.environ.get("DD_INSTRUMENTATION_TELEMETRY_ENABLED") is None: - os.environ["DD_INSTRUMENTATION_TELEMETRY_ENABLED"] = "false" + # Telemetry is required for Appsec Software Composition Analysis + os.environ["DD_INSTRUMENTATION_TELEMETRY_ENABLED"] = os.environ.get( + "DD_APPSEC_ENABLED", "false" + ) if os.environ.get("DD_API_SECURITY_ENABLED") is None: os.environ["DD_API_SECURITY_ENABLED"] = "False"