Skip to content

feat(appsec): add HTTPX2 SSRF and API10 protection - #19919

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
florentin.labelle/appsec/httpx2-ssrf
Aug 31, 2026
Merged

feat(appsec): add HTTPX2 SSRF and API10 protection#19919
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
florentin.labelle/appsec/httpx2-ssrf

Conversation

@florentinl

@florentinl florentinl commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Description

Adds ASM SSRF exploit prevention and OWASP API Top 10 security risk analysis for the Pydantic HTTPX2 client. HTTPX2 now publishes the established HTTPX request events so the existing tracing and AppSec subscribers handle both integrations without coupling contrib code to AppSec.

The shared HTTPX patcher now owns the HTTPX request and send event names directly; the HTTPX and HTTPX2 integrations only provide their library module and configuration. The AppSec Django, Flask, FastAPI, and Tornado threat suites exercise both the HTTPX2 2.0.0 floor and latest, with synchronized Riot requirements lockfiles.

Testing

  • scripts/run-tests --venv 13baca8 -- -- -q -k "test_exploit_prevention and (parameters42 or parameters50)" — 64 passed
  • HTTPX2 API10 slices across Flask, FastAPI, Django, and Tornado — 98 passed
  • scripts/run-tests -s --venv 7207b3b -- -- -k httpx2 and scripts/run-tests -s --venv 147970c -- -- -k httpx2 — 56 passed across HTTPX2 2.0.0 and latest/2.12.0
  • scripts/run-tests -s --venv 14859e9 --venv 1e7c279 --venv 143e698 — 129 passed, 1 expected version-gated skip across HTTPX latest and HTTPX2 floor/latest
  • scripts/lint checks
  • scripts/lint spelling -- releasenotes/notes/appsec-httpx2-ssrf-protection-cb13c93a891fdf2b.yaml
  • uv tool run --from reno reno lint

Risks

HTTPX2 now uses the same request event names as HTTPX, and those names are fixed in the shared patcher. The HTTPX and HTTPX2 integration suites plus focused AppSec coverage validate normal tracing and security handling. The AppSec Riot matrix doubles its HTTPX2 dependency dimension to cover the compatibility floor and newest compatible release.

Additional Notes

Riot requirements were synchronized with scripts/ddtest env RIOT_PIP_COMPILE_BACKEND=uv scripts/compile-and-prune-test-requirements.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

No remaining files require a CODEOWNERS review.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 28, 2026

Copy link
Copy Markdown

Circular import analysis

⚠️ Existing circular imports

There are 3 circular imports that already exist on the base branch and have not been changed by this PR.

ddtrace.errortracking._handled_exceptions.bytecode_injector -> ddtrace.errortracking._handled_exceptions.callbacks -> ddtrace.errortracking._handled_exceptions.collector -> ddtrace.errortracking._handled_exceptions.bytecode_reporting -> ddtrace.errortracking._handled_exceptions.bytecode_injector
ddtrace.llmobs -> ddtrace.llmobs._evaluators -> ddtrace.llmobs._evaluators.format -> ddtrace.llmobs._experiment -> ddtrace.llmobs
ddtrace.appsec._asm_request_context -> ddtrace.appsec._iast._iast_request_context_base -> ddtrace.appsec._iast._iast_env -> ddtrace.appsec._iast.reporter -> ddtrace.appsec._exploit_prevention.stack_traces -> ddtrace.appsec._asm_request_context

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 28, 2026

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

There are 240 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 240 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=135)
ddtrace.llmobs._integrations.vertexai -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.debugging._signal.tracing -×-> ddtrace.trace  (product:debugging -> product:tracing, score=133)
ddtrace.llmobs._integrations.google_adk -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.llmobs._integrations.base -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

@datadog-official

datadog-official Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9180782 | Docs | View more details | Give us feedback!

@florentinl
florentinl force-pushed the florentin.labelle/appsec/httpx2-ssrf branch 2 times, most recently from b6eb22a to 77d455f Compare August 28, 2026 11:48
@pr-commenter

pr-commenter Bot commented Aug 28, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-31 08:00:30

Comparing candidate commit 9180782 in PR branch florentin.labelle/appsec/httpx2-ssrf with baseline commit 5b87629 in branch main.

📊 Benchmarking dashboard

Found 0 performance improvements and 6 performance regressions! Performance is the same for 578 metrics, 10 unstable metrics, 2 known flaky benchmarks, 16 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:httppropagationinject-ids_only

  • 🟥 execution_time [+2.557µs; +2.702µs] or [+15.264%; +16.135%]

scenario:iastaspects-title_aspect

  • 🟥 execution_time [+74.972µs; +81.164µs] or [+27.802%; +30.098%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+117.045µs; +124.971µs] or [+28.363%; +30.284%]

scenario:iastaspectssplit-rsplit_aspect

  • 🟥 execution_time [+22.226µs; +27.853µs] or [+15.440%; +19.348%]

scenario:telemetryaddmetric-1-count-metric-1-times

  • 🟥 execution_time [+612.123ns; +654.302ns] or [+22.224%; +23.755%]

scenario:tracer-small

  • 🟥 execution_time [+32.757µs; +35.768µs] or [+9.853%; +10.759%]

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:coreapiscenario-context_with_data_listeners

  • unstable execution_time [-677.191ns; +794.781ns] or [-6.175%; +7.248%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-31.769ns; +34.799ns] or [-5.219%; +5.716%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1740.826ns; +1594.866ns] or [-10.156%; +9.304%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1301.598ns; +1235.488ns] or [-9.887%; +9.385%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-320.309ns; +333.504ns] or [-8.709%; +9.068%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-258.902ns; +253.868ns] or [-8.809%; +8.638%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-92.351ns; +53.941ns] or [-7.793%; +4.552%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-3792.156ns; +4223.327ns] or [-9.232%; +10.281%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-722.126ns; +846.903ns] or [-8.817%; +10.341%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-57.985µs; +60.532µs] or [-9.280%; +9.688%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:iastaspects-casefold_noaspect

  • 🟥 execution_time [+67.221µs; +71.225µs] or [+27.085%; +28.698%]

scenario:span-start

  • 🟥 execution_time [+1.198ms; +1.351ms] or [+8.445%; +9.526%]

Known flaky benchmarks without significant changes:

  • scenario:errortrackingflasksqli-baseline
  • scenario:flasksimple-iast-get
  • scenario:iastaspects-casefold_aspect
  • scenario:iastaspects-index_aspect
  • scenario:iastaspects-ljust_noaspect
  • scenario:iastaspects-lower_aspect
  • scenario:iastaspects-replace_aspect
  • scenario:iastaspects-swapcase_aspect
  • scenario:iastaspects-title_noaspect
  • scenario:iastaspects-translate_aspect
  • scenario:iastaspects-translate_noaspect
  • scenario:iastaspects-upper_noaspect
  • scenario:packagespackageforrootmodulemapping-cache_off
  • scenario:packagespackageforrootmodulemapping-cache_on
  • scenario:sethttpmeta-all-enabled
  • scenario:telemetryaddmetric-record-100-metrics

@florentinl
florentinl marked this pull request as ready for review August 28, 2026 12:18
@florentinl
florentinl requested review from a team as code owners August 28, 2026 12:18
Comment thread ddtrace/contrib/internal/httpx2/patch.py Outdated
@florentinl
florentinl force-pushed the florentin.labelle/appsec/httpx2-ssrf branch from 77d455f to 0fb37d9 Compare August 28, 2026 12:52
@florentinl
florentinl marked this pull request as draft August 28, 2026 12:52
@florentinl
florentinl marked this pull request as ready for review August 28, 2026 12:53
@florentinl
florentinl requested a review from dubloom August 28, 2026 12:55
@florentinl

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 28, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-28 13:04:42 UTC ℹ️ Start processing command /merge


2026-08-28 13:04:58 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-08-28 14:54:09 UTC ⚠️ MergeQueue: This merge request was unqueued

florentin.labelle@datadoghq.com unqueued this merge request

@florentinl

Copy link
Copy Markdown
Contributor Author

/remove

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 28, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-28 14:54:03 UTC ℹ️ Start processing command /remove


2026-08-28 14:54:08 UTC ℹ️ Devflow: /remove

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit ef1732e into main Aug 31, 2026
1345 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the florentin.labelle/appsec/httpx2-ssrf branch August 31, 2026 09:23
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.

4 participants