Skip to content

Extract Lambda event parsing out of LambdaAppSecHandler - #12202

Open
claponcet wants to merge 1 commit into
masterfrom
clara.poncet/lambda-http-tags
Open

Extract Lambda event parsing out of LambdaAppSecHandler#12202
claponcet wants to merge 1 commit into
masterfrom
clara.poncet/lambda-http-tags

Conversation

@claponcet

@claponcet claponcet commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Splits LambdaAppSecHandler (1211 lines) into three files, with no behaviour change:

  • LambdaEventParser (new) — all payload parsing: parseEvent (event payload and JSON string), parseResponse, parseJsonValue, detectTriggerType, the five per-trigger extractors and their helpers. Holds the Moshi adapters and MAX_EVENT_SIZE. The LambdaTriggerType enum and the LambdaRequestData / LambdaResponseData value types move here as nested types. Contains no AppSec imports.
  • LambdaURIDataAdapter (new) — promoted from a private nested class to a top-level one, unchanged.
  • LambdaAppSecHandler — down to ~400 lines, now only the gateway-callback logic: processRequestStart, processRequestEnd, processResponseData, mergeContexts, processAppSecRequestData, TemporaryRequestContext and the single CURRENT_TRIGGER_TYPE thread-local.

Method bodies are moved verbatim. The parser keeps returning the LambdaRequestData.EMPTY sentinel (compared by identity in processRequestStart) rather than null, and the generic extractor still returns populated data for UNKNOWN triggers, so unrecognised events continue to reach the WAF exactly as before.

LambdaAppSecHandlerTest is updated only where it names moved symbols — LambdaTriggerType, detectTriggerType, and extractResponseData which is now parseResponse. No assertions changed.

Contributor Checklist

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@claponcet claponcet added tag: no release notes Changes to exclude from release notes type: refactoring comp: asm waf Application Security Management (WAF) inst: aws lambda AWS Lambda instrumentation tag: ai generated Largely based on code generated by an AI or LLM and removed inst: aws lambda AWS Lambda instrumentation labels Aug 13, 2026
@datadog-datadog-prod-us1

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Aug 13, 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.84 s 14.75 s [-0.2%; +1.5%] (no difference)
startup:insecure-bank:tracing:Agent 13.64 s 13.74 s [-1.3%; -0.1%] (maybe better)
startup:petclinic:appsec:Agent 17.37 s 17.25 s [-0.4%; +1.8%] (no difference)
startup:petclinic:iast:Agent 17.29 s 17.45 s [-1.8%; +0.0%] (no difference)
startup:petclinic:profiling:Agent 16.73 s 17.09 s [-6.4%; +2.2%] (no difference)
startup:petclinic:sca:Agent 17.27 s 16.60 s [-0.4%; +8.4%] (no difference)
startup:petclinic:tracing:Agent 16.03 s 16.27 s [-7.3%; +4.4%] (unstable)

Commit: 10834e7b · 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.

@claponcet
claponcet marked this pull request as ready for review August 13, 2026 14:41
@claponcet
claponcet requested review from a team as code owners August 13, 2026 14:41
@claponcet
claponcet requested review from jandro996 and mcculls August 13, 2026 14:41

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: PASS

More details

Sentinel identity, stream reset, unknown-trigger extraction, trigger propagation, and malformed/oversized response fallbacks remain intact. The relocated package-private symbols have no production callers outside the handler.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit 10834e7 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

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

Labels

comp: asm waf Application Security Management (WAF) tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant