Repository navigation
JULIO-13: prototype for the datadog-lambda-python LLD (do not merge) - #886
Draft
Julio-Guerra wants to merge 3 commits into
Draft
Julio-Guerra wants to merge 3 commits into
Julio-Guerra wants to merge 3 commits into
Conversation
Prototype for the JULIO-13 LLD (CADR for AWS Lambda). Behind
DD_APPSEC_AWS_ACCESS_KEY_ID_ENABLED (default off), on the tracer AppSec
path, tag the aws.lambda span of each AppSec-monitored HTTP invocation
with aws.lambda.access_key_id. AWS_ACCESS_KEY_ID is read once per
execution environment, at the first monitored invocation, validated
against (ASIA|AKIA)[A-Z0-9]{16}, and never read on SnapStart. The secret
access key and the session token are never read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
Unit and wrapper tests for RFC scenarios S1 to S8 that apply to the tracer path, the D3 validation cases, SnapStart, and a micro benchmark comparing the feature on and off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
…G_ENABLED Design change on the CADR for AWS Lambda RFC: the activation variable is renamed from DD_APPSEC_AWS_ACCESS_KEY_ID_ENABLED. The config property follows: appsec_aws_access_key_id_tag_enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
5 of 11 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Throwaway prototype for a design review. Do not merge.
What does this PR do?
On the tracer AppSec path, it tags the
aws.lambdaspan of each HTTP invocation that AppSec monitors withaws.lambda.access_key_id. The value is the execution environment'sAWS_ACCESS_KEY_ID. The tag is off by default, behindDD_APPSEC_AWS_ACCESS_KEY_ID_TAG_ENABLED.datadog_lambda/config.py: newappsec_aws_access_key_id_enabled(DD_APPSEC_AWS_ACCESS_KEY_ID_TAG_ENABLED, defaultfalse).datadog_lambda/asm.py:asm_start_requestsets the tag before it dispatchesaws_lambda.start_request, so the tag is in place before the WAF runs, including on blocked requests.AWS_ACCESS_KEY_IDis read once per process, at the first monitored invocation, not at import.(ASIA|AKIA)[A-Z0-9]{16}. Otherwise there is no tag and one debug line, without the value.AWS_LAMBDA_INITIALIZATION_TYPE=snap-start), it does not read and does not tag, becauseos.environcomes from the snapshot.wrapper.pyis unchanged.Motivation
CADR links AAP, Workload Protection and Cloud SIEM signals, but every correlation starts from a Workload Protection signal, and Workload Protection does not run on AWS Lambda. The execution environment's access key ID stays the same for the environment's life, and CloudTrail records it as
userIdentity.accessKeyId, so it can join an AAP signal on Lambda to Cloud SIEM signals. This prototype backs the datadog-lambda-python LLD of the "CADR for AWS Lambda" RFC (APPSEC-71674).Testing Guidelines
pytest tests: 1042 passed, 53 of them new. Local run on Python 3.12.8 with ddtrace 4.16.4.tests/test_asm.py: every HTTP event type, the feature off, canary secret and token, malformed and missing values, read-once caching, SnapStart, and non-HTTP triggers.tests/test_wrapper.py: the tag is onaws.lambdaand not on the inferred span; no tag with AppSec off; no tag with onlyDD_SERVERLESS_APPSEC_ENABLED; the same value on two invocations.crs-930-120fires, the tag is set, and neither canary appears.black --check datadog_lambda/ tests(black 25.11.0): clean.flake8on the changed files: clean.test_benchmarks.py::test_asm_start_request_access_key_id: median 12.88 µs with the feature off and 14.08 µs on, so about +1.2 µs per monitored invocation.Additional Notes
DD_SERVERLESS_APPSEC_ENABLEDdoes not turn tracer AppSec off in Python. If a function sets it together withDD_APPSEC_ENABLED, both AppSec paths run on the same span. The extension should therefore not tag tracer spans that carry_dd.appsec.serverless.tracer. This is proposed as an RFC addendum.Types of Changes
Check all that apply
🤖 Generated with Claude Code