Skip to content

Send raw response bodies to the waf - #4055

Merged
estringana merged 11 commits into
masterfrom
estringana/send-raw-response-bodies
Aug 3, 2026
Merged

Send raw response bodies to the waf#4055
estringana merged 11 commits into
masterfrom
estringana/send-raw-response-bodies

Conversation

@estringana

@estringana estringana commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

AppSec: Raw HTTP response body WAF inspection

Implements support for the server.response.body.raw WAF address, allowing the WAF to inspect the raw (unparsed) HTTP response body for attack patterns.

APPSEC-69453

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@estringana
estringana force-pushed the estringana/send-raw-response-bodies branch from fece7af to 742b490 Compare July 23, 2026 15:43
@datadog-official

datadog-official Bot commented Jul 23, 2026

Copy link
Copy Markdown

Pipelines  Tests

⚠️ Warnings

🚦 5 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-php | test_extension_ci: [8.0]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-php | test_web_custom: [8.3, cgi-fcgi]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-php | ASAN test_c: [8.0, arm64]   View in Datadog   GitLab

View all 5 failed jobs.

❄️ 1 New flaky test detected

WAF matches against raw JSON response body() from com.datadog.appsec.php.integration.RawResponseBodyTests   View in Datadog
java.lang.AssertionError: Expected WAF to fire on server.response.body.raw. Expression: (appsecJson != null). Values: appsecJson = null

java.lang.AssertionError: Expected WAF to fire on server.response.body.raw. Expression: (appsecJson != null). Values: appsecJson = null
	at org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:416)
	at com.datadog.appsec.php.integration.RawResponseBodyTests.WAF matches against raw JSON response body(RawResponseBodyTests.groovy:52)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

New test introduced in this PR is flaky.

View in Flaky Test Management

ℹ️ Info

No other issues found (see more)

🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 82.76%
Overall Coverage: 60.63% (-0.07%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 1dcb1c6 | Docs | Datadog PR Page | Give us feedback!

@estringana
estringana force-pushed the estringana/send-raw-response-bodies branch from 95c5143 to 70faeaf Compare July 27, 2026 10:06
@pr-commenter

pr-commenter Bot commented Jul 27, 2026

Copy link
Copy Markdown

Benchmarks [ appsec ]

Benchmark execution time: 2026-08-03 11:07:05

Comparing candidate commit 1dcb1c6 in PR branch estringana/send-raw-response-bodies with baseline commit e3b075e in branch master.

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

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 ----------------------------------'

@estringana
estringana force-pushed the estringana/send-raw-response-bodies branch from b942c4b to 8b32d86 Compare July 28, 2026 10:29
@pr-commenter

pr-commenter Bot commented Jul 28, 2026

Copy link
Copy Markdown

Benchmarks [ tracer ]

Benchmark execution time: 2026-08-03 11:41:32

Comparing candidate commit 1dcb1c6 in PR branch estringana/send-raw-response-bodies with baseline commit e3b075e in branch master.

Found 2 performance improvements and 2 performance regressions! Performance is the same for 189 metrics, 1 unstable metrics.

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:HookBench/benchHookOverheadTraceFunction

  • 🟥 execution_time [+5.343µs; +8.735µs] or [+2.640%; +4.316%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization

  • 🟩 execution_time [-11.097µs; -8.023µs] or [-9.869%; -7.136%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache

  • 🟩 execution_time [-8.259µs; -6.281µs] or [-7.250%; -5.514%]

scenario:PHPRedisBench/benchRedisOverhead

  • 🟥 execution_time [+41.807µs; +58.597µs] or [+4.121%; +5.776%]

@estringana
estringana force-pushed the estringana/send-raw-response-bodies branch 2 times, most recently from c8f7b03 to fdf6f00 Compare July 29, 2026 09:36
@estringana
estringana marked this pull request as ready for review July 29, 2026 13:38
@estringana
estringana requested review from a team as code owners July 29, 2026 13:38
@estringana
estringana requested review from sameerank and vjfridge and removed request for a team July 29, 2026 13:38

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

Copy link
Copy Markdown

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: fdf6f005af

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread appsec/src/extension/commands/request_shutdown.c Outdated
Comment thread appsec/src/extension/commands/request_shutdown.c
@estringana
estringana force-pushed the estringana/send-raw-response-bodies branch from b973988 to 449001f Compare July 30, 2026 10:15
@estringana
estringana force-pushed the estringana/send-raw-response-bodies branch from c6bc0d9 to e8c744e Compare July 30, 2026 13:25
@estringana
estringana force-pushed the estringana/send-raw-response-bodies branch from c699fc7 to d5a6082 Compare July 31, 2026 10:53
Comment thread appsec/tests/extension/rshutdown_command_raw_body_size_capped.phpt
@estringana
estringana merged commit 8b890b8 into master Aug 3, 2026
2154 of 2159 checks passed
@estringana
estringana deleted the estringana/send-raw-response-bodies branch August 3, 2026 15:42
@github-actions github-actions Bot added this to the 1.24.0 milestone Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants