AppSec Lambda: Analyze HTTP response#11750
Conversation
…tension dedup Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
090da74 to
65bb844
Compare
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d2a12a4fb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 868f9a139e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| // Extract headers — keys are lowercased to normalise casing across API GW / ALB variants | ||
| Map<String, String> headers = new HashMap<>(); | ||
| Map<String, String> rawHeaders = extractStringMap(response.get("headers")); |
There was a problem hiding this comment.
Forward response cookies from v2 payloads
For API Gateway HTTP API v2 and Lambda Function URL responses, cookies can be returned in the top-level cookies array and are sent to clients as Set-Cookie headers, but this extraction only reads headers and multiValueHeaders. In those responses AppSec never receives the response cookies, so rules/redaction depending on Set-Cookie are skipped; merge response.get("cookies") into the forwarded response headers before responseHeaderDone.
Useful? React with 👍 / 👎.
What Does This Do
Adds AppSec response analysis for AWS Lambda:
LambdaAppSecHandler.processResponseDataparses the Lambda response object and fires the WAF gateway events (
responseStarted,responseHeader,responseHeaderDone,responseBody) with the extracted status code,headers, and body.
Trigger-type detection (API Gateway v1/v2, ALB, Lambda URL, WebSocket) is added to
processRequestStartand stored in aThreadLocal.processResponseDatauses it todecide whether to parse the response as an API-GW envelope or fall back to treating the
whole payload as a plain response body, matching how non-envelope HTTP triggers behave.
CoreTracer.notifyAppSecEndis extended to receive the raw result object so it can beforwarded to
processResponseDatafrom the Lambda handler instrumentation.Additional extraction improvements:
isBase64Encodedaccepts"true"(string) in addition toBoolean.TRUELambdaHandlerInstrumentationTestandLambdaAppSecHandlerTestmigrated from Spock/Groovyto JUnit 5 Java, with new test cases for response analysis and trigger-type gating.
Motivation
Allows the WAF to inspect Lambda HTTP responses for threats.
Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue/merge.Jira ticket: APPSEC-60532