Skip to content

Add HTTP span tags, content-type body parsing, and unsupported-event marking to AWS Lambda AppSec - #12078

Draft
claponcet wants to merge 1 commit into
masterfrom
clara.poncet/lambda-appsec-milestone1-gaps
Draft

Add HTTP span tags, content-type body parsing, and unsupported-event marking to AWS Lambda AppSec#12078
claponcet wants to merge 1 commit into
masterfrom
clara.poncet/lambda-appsec-milestone1-gaps

Conversation

@claponcet

Copy link
Copy Markdown
Contributor

What Does This Do

Extends the AWS Lambda AppSec request/response handling (LambdaAppSecHandler) to close milestone-1 gaps against the Python (datadog-lambda-python) and extension implementations:

  • HTTP span tags: derives http.url (query-less, so QueryObfuscator can redact and re-append it), http.route, http.useragent, http.method, and http.query.string from the event at request-end, mirroring HttpServerDecorator (which Lambda has no equivalent of).
  • Route extraction: http.route from API Gateway v1 resource and v2 routeKey (method prefix stripped; $default and Function-URL routes omitted).
  • Content-type body parsing: strict dispatch — application/x-www-form-urlencoded → structured map, JSON content-types → parsed (malformed JSON dropped, matching the extension), missing content-type → best-effort JSON with raw-string fallback, everything else (incl. multipart) → raw string.
  • Case-insensitive headers: request header keys are lowercased (as response headers already were), via a shared extractLowercasedStringMap helper.
  • _dd.appsec.unsupported_event_type marker: set on the serverless span for non-HTTP events (parsed-but-unknown triggers and non-ByteArrayInputStream/POJO events), mutually exclusive with _dd.appsec.enabled — matching the cross-tracer system-test contract.
  • Trigger detection: a missing/non-string domainName on an http-shaped event now resolves to API_GATEWAY_V2_HTTP rather than defaulting to LAMBDA_URL (consistent with the Rust extension and Python layer).

Motivation

Aligns Java Lambda AppSec behavior with the reference implementations so the java_lambda system-test suite can close gaps currently marked missing_feature relative to python_lambda.

Additional Notes

Behavior verified by unit tests in LambdaAppSecHandlerTest (127 tests). Multipart bodies are intentionally forwarded as the raw string rather than structurally decomposed (the raw payload stays scannable by string-based WAF rules); structured multipart parsing is noted as follow-up work.

Jira ticket: [APPSEC-XXXX]

…marking to AWS Lambda AppSec

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claponcet claponcet added type: feature Enhancements and improvements inst: aws lambda AWS Lambda instrumentation tag: ai generated Largely based on code generated by an AI or LLM labels Jul 27, 2026
@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Jul 27, 2026

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 81.30%
Overall Coverage: 57.57% (-0.02%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a2816e4 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.02 s 13.95 s [-0.3%; +1.3%] (no difference)
startup:insecure-bank:tracing:Agent 12.94 s 12.93 s [-0.6%; +0.7%] (no difference)
startup:petclinic:appsec:Agent 16.89 s 16.80 s [-0.5%; +1.5%] (no difference)
startup:petclinic:iast:Agent 16.87 s 16.43 s [-1.7%; +7.0%] (no difference)
startup:petclinic:profiling:Agent 16.67 s 16.15 s [-1.3%; +7.8%] (no difference)
startup:petclinic:sca:Agent 16.93 s 16.76 s [-0.1%; +2.3%] (no difference)
startup:petclinic:tracing:Agent 16.11 s 16.13 s [-0.8%; +0.5%] (no difference)

Commit: a2816e43 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inst: aws lambda AWS Lambda instrumentation tag: ai generated Largely based on code generated by an AI or LLM type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant