Skip to content

Add Java support for AWS Lambdas#6278

Merged
claponcet merged 9 commits into
mainfrom
clara.poncet/java-lambdas-appsec
Mar 4, 2026
Merged

Add Java support for AWS Lambdas#6278
claponcet merged 9 commits into
mainfrom
clara.poncet/java-lambdas-appsec

Conversation

@claponcet
Copy link
Copy Markdown
Contributor

Motivation

We are adding AppSec support for AWS Lambdas in Java and need system-tests to validate it.

Changes

A new library was created: java_lambda as it as been done for python_lambda, with 5 weblogs for each lambda trigger-type, and a new manifest.

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 11, 2026

CODEOWNERS have been resolved as:

manifests/java_lambda.yml                                               @DataDog/system-tests-core
utils/build/docker/java_lambda/app.sh                                   @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java_lambda/java-alb-multi.Dockerfile                @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java_lambda/java-alb.Dockerfile                      @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java_lambda/java-apigw-http.Dockerfile               @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java_lambda/java-apigw-rest.Dockerfile               @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java_lambda/java-function-url.Dockerfile             @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java_lambda/pom.xml                                  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java_lambda/src/main/java/com/datadoghq/lambda/Handler.java  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
conftest.py                                                             @DataDog/system-tests-core
docs/edit/manifest.md                                                   @DataDog/system-tests-core
tests/test_the_test/test_compute_libraries_and_scenarios.py             @DataDog/system-tests-core
utils/_context/component_version.py                                     @DataDog/system-tests-core
utils/_decorators.py                                                    @DataDog/system-tests-core
utils/build/build.sh                                                    @DataDog/system-tests-core
utils/manifest/_internal/parser.py                                      @DataDog/system-tests-core
utils/scripts/activate_easy_wins/_internal/const.py                     @DataDog/system-tests-core
utils/scripts/ci_orchestrators/workflow_data.py                         @DataDog/system-tests-core
utils/scripts/compute-workflow-parameters.py                            @DataDog/system-tests-core
utils/scripts/compute_libraries_and_scenarios.py                        @DataDog/system-tests-core
utils/scripts/get-image-list.py                                         @DataDog/system-tests-core
utils/scripts/libraries_and_scenarios_rules.yml                         @DataDog/system-tests-core
utils/scripts/load-binary.sh                                            @DataDog/system-tests-core

@datadog-datadog-prod-us1
Copy link
Copy Markdown

datadog-datadog-prod-us1 Bot commented Feb 11, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 75ab8d8 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

Copy link
Copy Markdown
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

Could you do a search for the term python_lambda everywhere in the code, and if needed, add java_lambda? If you have any doubt, ping me, we'll go threw this list together.

Comment thread utils/build/build.sh Outdated
readonly DEFAULT_cpp_httpd=httpd
readonly DEFAULT_cpp_nginx=nginx
readonly DEFAULT_python_lambda=apigw-rest
readonly DEFAULT_java_lambda=apigw-rest
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Weblog names must be unique, can you pick another one?

@cbeauchesne
Copy link
Copy Markdown
Collaborator

You can run ./format.sh locally to fix lint issue.
For test_the_test, ping me if you need some help.

@claponcet claponcet force-pushed the clara.poncet/java-lambdas-appsec branch from 834b011 to 15a6f81 Compare February 25, 2026 14:50
Copy link
Copy Markdown
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

You'll need to adapt ./utils/script/load_binary.sh to support java_lambda.

Since the underlying details may be not that obvious, we can meet to discuss what will happen with all of that. You can DM me to see that.

@claponcet claponcet force-pushed the clara.poncet/java-lambdas-appsec branch from 3e41651 to d89cb50 Compare March 3, 2026 09:45
Copy link
Copy Markdown
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

The failure is not related, I'm fixing it.

@claponcet claponcet marked this pull request as ready for review March 4, 2026 12:19
@claponcet claponcet requested review from a team as code owners March 4, 2026 12:19
@claponcet claponcet merged commit de4f3ca into main Mar 4, 2026
3371 of 3375 checks passed
@claponcet claponcet deleted the clara.poncet/java-lambdas-appsec branch March 4, 2026 12:23
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75ab8d8280

ℹ️ 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".

Comment on lines +147 to +148
event.getQueryStringParameters(),
event.getHeaders(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Read multi-value ALB request fields

Handle the ALB multi-value trigger by consuming multiValueQueryStringParameters and multiValueHeaders when present. In the checked lambda-proxy path (utils/build/docker/lambda_proxy/alb.py), build_alb_event(..., multi=True) only sets those multi-value fields, so using event.getQueryStringParameters() and event.getHeaders() here drops query/header data for java-alb-multi requests; that can break parameter-driven endpoints and prevent the user-agent tag enrichment used for request/span matching.

Useful? React with 👍 / 👎.

Comment on lines +585 to +588
APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent();
response.setStatusCode(statusCode);
response.setBody(body);
response.setHeaders(headers != null ? headers : new HashMap<>());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Populate multiValueHeaders for ALB multi responses

Return multiValueHeaders for REST/ALB responses in the multi-value ALB flow. I checked utils/build/docker/lambda_proxy/alb.py, and parse_alb_lambda_output(..., multi=True) reads resp["multiValueHeaders"] (not headers), but this branch only sets headers; for java-alb-multi, response headers are therefore lost (and can fail if the serializer omits multiValueHeaders entirely), impacting header/cookie-sensitive behavior.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants