Skip to content

feat(asm): add handlers to support the AWS Lambda framework #13638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 17, 2025

Conversation

florentinl
Copy link
Contributor

@florentinl florentinl commented Jun 10, 2025

Jira Ticket: APPSEC-57889

Description

In AWS Lambda, the AppsecSpanProcessor need to be able to process SERVERLESS spans. It also adds appsec listeners to enable the aws_lambda instrumentation to call the waf in the context of Threat Detection.

This is a follow up on #13602 and likewise it should have no impact in production as long as the libddwaf binary is being stripped from the datadog_lambda layer.

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Jun 10, 2025

CODEOWNERS have been resolved as:

ddtrace/appsec/_http_utils.py                                           @DataDog/asm-python
tests/appsec/appsec/test_appsec_http_utils.py                           @DataDog/asm-python
ddtrace/appsec/_handlers.py                                             @DataDog/asm-python
ddtrace/appsec/_processor.py                                            @DataDog/asm-python
ddtrace/settings/asm.py                                                 @DataDog/asm-python

@florentinl florentinl force-pushed the florentin.labelle/APPSEC-57889/waf-for-aws-lambda branch 2 times, most recently from 6709855 to 4492c44 Compare June 10, 2025 15:05
Copy link
Contributor

github-actions bot commented Jun 10, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 274 ± 2 ms.

The average import time from base is: 276 ± 4 ms.

The import time difference between this PR and base is: -2.4 ± 0.1 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 2.004 ms (0.73%)
ddtrace.bootstrap.sitecustomize 1.330 ms (0.49%)
ddtrace.bootstrap.preload 1.330 ms (0.49%)
ddtrace.internal.remoteconfig.client 0.638 ms (0.23%)
ddtrace 0.674 ms (0.25%)
ddtrace.internal._unpatched 0.031 ms (0.01%)
json 0.031 ms (0.01%)
json.decoder 0.031 ms (0.01%)
re 0.031 ms (0.01%)
enum 0.031 ms (0.01%)
types 0.031 ms (0.01%)

@pr-commenter
Copy link

pr-commenter bot commented Jun 10, 2025

Benchmarks

Benchmark execution time: 2025-06-17 10:19:11

Comparing candidate commit 25b01e6 in PR branch florentin.labelle/APPSEC-57889/waf-for-aws-lambda with baseline commit 5692392 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 561 metrics, 3 unstable metrics.

@florentinl florentinl added changelog/no-changelog A changelog entry is not required for this PR. ASM Application Security Monitoring labels Jun 11, 2025
@florentinl florentinl force-pushed the florentin.labelle/APPSEC-57889/waf-for-aws-lambda branch 6 times, most recently from 7b93891 to 696901e Compare June 12, 2025 13:44
@florentinl florentinl changed the title chore(asm): process SERVERLESS spans when calling the waf inside aws lambda feat(asm): add handlers to support the AWS Lambda framework Jun 12, 2025
@florentinl florentinl force-pushed the florentin.labelle/APPSEC-57889/waf-for-aws-lambda branch from 696901e to 48f3162 Compare June 12, 2025 13:56
@DataDog DataDog deleted a comment from github-actions bot Jun 12, 2025
@florentinl florentinl force-pushed the florentin.labelle/APPSEC-57889/waf-for-aws-lambda branch 2 times, most recently from cb29928 to 06e635e Compare June 16, 2025 07:46
@florentinl florentinl force-pushed the florentin.labelle/APPSEC-57889/waf-for-aws-lambda branch from 06e635e to 3dccec0 Compare June 16, 2025 07:50
@florentinl florentinl force-pushed the florentin.labelle/APPSEC-57889/waf-for-aws-lambda branch from 3dccec0 to b1eb42f Compare June 16, 2025 08:49
@florentinl florentinl marked this pull request as ready for review June 16, 2025 09:31
@florentinl florentinl requested a review from a team as a code owner June 16, 2025 09:31
@florentinl florentinl force-pushed the florentin.labelle/APPSEC-57889/waf-for-aws-lambda branch 2 times, most recently from 5d83892 to 8bc17d6 Compare June 17, 2025 09:21
@florentinl florentinl force-pushed the florentin.labelle/APPSEC-57889/waf-for-aws-lambda branch from 8bc17d6 to 25b01e6 Compare June 17, 2025 09:36
@florentinl florentinl merged commit b97c4d5 into main Jun 17, 2025
521 of 522 checks passed
@florentinl florentinl deleted the florentin.labelle/APPSEC-57889/waf-for-aws-lambda branch June 17, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASM Application Security Monitoring changelog/no-changelog A changelog entry is not required for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants