Skip to content

🍒 13318, 13493, 13525, 13543, 13548 - AppSec blocking fixes for 1.69.1 - #13571

Merged
jandro996 merged 6 commits into
release/v1.69.xfrom
alejandro.gonzalez/backport-1.69.1
Nov 20, 2026
Merged

jandro996 merged 6 commits into
release/v1.69.xfrom
alejandro.gonzalez/backport-1.69.1

Conversation

@jandro996

@jandro996 jandro996 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What Does This Do

Backport to release/v1.69.x for the 1.69.1 patch release. All backported PRs are type: bug fix:

Each one is a git cherry-pick -x of its master squash commit, in this order, because #13493 depends on #13318 and #13548 depends on #13493. That is why they ship in a single PR instead of one PR each.

One extra commit regenerates the two gradle.lockfiles touched by #13525 (dd-java-agent/appsec, spring-webmvc-6.0) with --write-locks on this branch, so they keep the release-branch versions instead of master's.

Motivation

1.69.1 patch release (incident IR-63830). Jetty 12 request-phase blocking (#13317) and the libddwaf SSRF fix (#13369) already shipped in 1.69.0; these are the remaining fixes.

Additional Notes

A local build of this branch passed the same end-to-end AppSec validation as master 98a3b29101: 885 checks on Jetty 12.1, Jetty 11, Spring Boot 3.5/4.0 on Tomcat and Undertow, with verdicts identical to the master build and no regressions against 1.69.0's baseline.

Jira ticket: APPSEC-71812

jandro996 and others added 6 commits November 20, 2026 09:45
…13318)

Block Jetty 12 responses before commit on response-phase AppSec rules

Enable Jetty 12 blocking on response tests

Mark the Jetty 12 BlockResponseFunction after a response-phase block and reuse shared helpers

Claim the BlockResponseFunction with tryClaim after a response-phase block

Exclude client disconnects from telemetry on response-phase block write failures

Merge branch 'master' into APPSEC-71562-response-phase

Claim the BlockResponseFunction before writing the response-phase block page

Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
(cherry picked from commit 5b2296d)
…finishes (#13493)

Defer Jetty 12 request completion until a mid-handler block write finishes

The Jetty 12 BlockResponseFunction writes the blocking response
asynchronously. Mid-handler callers (RASP, user blocking, session id,
Jersey JSON body) then throw BlockingException, and ee8/ee9/ee10 complete
the Handler callback right away. If the block write is still pending,
Jetty cancels it and the client receives a truncated blocking page.

The Server.handle AppSec advice now wraps the Handler callback when AppSec
is active and our BlockResponseFunction is registered. While a block
write is in flight, the wrapper parks the first completion and replays it
with the same outcome from the write callback. Otherwise completions are
forwarded unchanged. No Jetty thread waits.

Add Java/JUnit 5 forked tests for ee10 and ee9 that block mid-handler
with a large custom template against a slow reader. Without the change
the client receives about 64 KB of a 400 KiB page.

Defer Jetty 12 completion for core handler throws and response-phase blocks

A Throwable escaping Server.handle from a core handler made Jetty fail its
own reference to the Handler callback, bypassing the deferring wrapper.
The exit advice now fails the callback through the wrapper and returns as
handled.

The response-phase block write now also marks itself in flight on the
wrapper, so a completion arriving while it is pending (async servlet
writes, or a mid-handler caller that lost the claim) is deferred too.

Combine write callback invocation type and encapsulate in-flight tracking

Write callbacks that may replay the parked Handler completion now declare
the combined invocation type of their own callback and the wrapper, so
Jetty does not run blocking completion work as non-blocking.

Keep the in-flight write tracking inside JettyBlockResponseFunction
(null-safe start/finish, finish-then-release), and tidy the related tests.

review: pre-PR checks

- Only take over a Throwable escaping Server.handle while a block write
  is in flight; otherwise Jetty behaves as before
- Catch Exception, not Throwable, on the request-thread takeover path
- Complete the original write callback before replaying the parked
  Handler completion in the response-phase block callback
- Add a forked end-to-end test for a core Handler that throws after a
  mid-handler block, exercising the real Server.handle advice
- Tidy a block comment and static imports

Address review: cover parked completions and unhandled core blocks

- Take over a Throwable escaping Server.handle while the wrapper is
  deferring, including when a completion is already parked
- When a core handler returns false after a blocking response was
  initiated, complete the wrapper and report the request as handled,
  instead of letting Jetty write a 404 over the blocking page
- Align the failDeferred Javadoc with its catch (Exception)
- Add the ee8 truncation test
- Make the wrapper's write tracking methods package-private

Document the request parameter of completeUnhandledBlock

Merge branch 'master' into APPSEC-71599

Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
(cherry picked from commit f74c7fd)
#13525)

Send Spring 7 SmartHttpMessageConverter bodies to the WAF

- HttpMessageConverterInstrumentation: advise the SmartHttpMessageConverter
  overloads read(ResolvableType, HttpInputMessage, Map) and
  write(Object, ResolvableType, MediaType, HttpOutputMessage, Map)
  (spring-web 6.2+: Jackson 3 and Kotlin serialization converters, the
  Spring Boot 4 default for JSON)
- ObjectIntrospection: convert Jackson 3 (tools.jackson) JsonNode bodies
- Add spring7Test suite (Spring 7.0.7, Jackson 3.1.2) in spring-webmvc-6.0
  and jackson3Test suite in appsec

Cap Jackson node container capacity to the conversion budget

Initial ArrayList/HashMap capacities in doConversionJacksonNode used the
full node size, so an oversized Jackson 2 or 3 node allocated slots the
conversion never fills (it stops at the element budget).

Bound ObjectIntrospection work by the element budget

Generic Map, Collection and array conversions now size their output
containers by the remaining element budget, and the three object loops
stop at the first key dropped for lack of budget instead of walking the
remaining keys. The converted output is unchanged.

Test the entry-iterable and Jackson 2 node budget paths

Covers the Iterable<Map.Entry> branch and the Jackson node key loop with
inputs larger than the element budget.

Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
(cherry picked from commit 20045be)
…13543)

Send Spring 7 SmartHttpMessageConverter bodies to the WAF

- HttpMessageConverterInstrumentation: advise the SmartHttpMessageConverter
  overloads read(ResolvableType, HttpInputMessage, Map) and
  write(Object, ResolvableType, MediaType, HttpOutputMessage, Map)
  (spring-web 6.2+: Jackson 3 and Kotlin serialization converters, the
  Spring Boot 4 default for JSON)
- ObjectIntrospection: convert Jackson 3 (tools.jackson) JsonNode bodies
- Add spring7Test suite (Spring 7.0.7, Jackson 3.1.2) in spring-webmvc-6.0
  and jackson3Test suite in appsec

Cap Jackson node container capacity to the conversion budget

Initial ArrayList/HashMap capacities in doConversionJacksonNode used the
full node size, so an oversized Jackson 2 or 3 node allocated slots the
conversion never fills (it stops at the element budget).

Bound ObjectIntrospection work by the element budget

Generic Map, Collection and array conversions now size their output
containers by the remaining element budget, and the three object loops
stop at the first key dropped for lack of budget instead of walking the
remaining keys. The converted output is unchanged.

Test the entry-iterable and Jackson 2 node budget paths

Covers the Iterable<Map.Entry> branch and the Jackson node key loop with
inputs larger than the element budget.

Write the Tomcat block page when the response was suspended by sendError

Tomcat rejects an encoded slash in the path with sendError(400), which
suspends the response output. Response.reset() does not lift that
suspension, so a WAF block committed afterwards sent its 403 status and
Content-Length but dropped the body, and the client waited on the open
connection. The blocking helper now lifts the suspension after the reset,
as Tomcat's own error valves do before they write.

Test the Tomcat block commit on a suspended response

Pins that the blocking helper lifts the sendError suspension after the
reset and before writing the block page, and leaves the suspension flag
alone when the response is not suspended.

Test blocking a Tomcat request whose encoded-slash path was rejected

Runs on Tomcat 10.1 and 11 through the latest10 and latestDep forked
suites. A URI callback blocks the request, as a URI WAF rule would, and a
raw socket checks that the 403 body matches its Content-Length. It also
checks that an unblocked encoded-slash path still gets Tomcat's 400 and
that blocking a plain path is unchanged.

Simplify the Tomcat encoded-slash blocking test

Shares the blocked-path assertions in one helper, keeps the URI callback
records per test instance, and drops an unused toString().

review: pre-PR checks

- Pin encodedSolidusHandling=reject on the forked test connector, so the
  test always reaches the sendError(400) path it guards
- Mention the suspension check in the TomcatBlockingHelperTest Javadoc

Merge branch 'master' into APPSEC-71828

Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
(cherry picked from commit bcc328c)
…response (#13548)

Send Spring 7 SmartHttpMessageConverter bodies to the WAF

- HttpMessageConverterInstrumentation: advise the SmartHttpMessageConverter
  overloads read(ResolvableType, HttpInputMessage, Map) and
  write(Object, ResolvableType, MediaType, HttpOutputMessage, Map)
  (spring-web 6.2+: Jackson 3 and Kotlin serialization converters, the
  Spring Boot 4 default for JSON)
- ObjectIntrospection: convert Jackson 3 (tools.jackson) JsonNode bodies
- Add spring7Test suite (Spring 7.0.7, Jackson 3.1.2) in spring-webmvc-6.0
  and jackson3Test suite in appsec

Cap Jackson node container capacity to the conversion budget

Initial ArrayList/HashMap capacities in doConversionJacksonNode used the
full node size, so an oversized Jackson 2 or 3 node allocated slots the
conversion never fills (it stops at the element budget).

Bound ObjectIntrospection work by the element budget

Generic Map, Collection and array conversions now size their output
containers by the remaining element budget, and the three object loops
stop at the first key dropped for lack of budget instead of walking the
remaining keys. The converted output is unchanged.

Test the entry-iterable and Jackson 2 node budget paths

Covers the Iterable<Map.Entry> branch and the Jackson node key loop with
inputs larger than the element budget.

Write the Tomcat block page when the response was suspended by sendError

Tomcat rejects an encoded slash in the path with sendError(400), which
suspends the response output. Response.reset() does not lift that
suspension, so a WAF block committed afterwards sent its 403 status and
Content-Length but dropped the body, and the client waited on the open
connection. The blocking helper now lifts the suspension after the reset,
as Tomcat's own error valves do before they write.

Test the Tomcat block commit on a suspended response

Pins that the blocking helper lifts the sendError suspension after the
reset and before writing the block page, and leaves the suspension flag
alone when the response is not suspended.

Test blocking a Tomcat request whose encoded-slash path was rejected

Runs on Tomcat 10.1 and 11 through the latest10 and latestDep forked
suites. A URI callback blocks the request, as a URI WAF rule would, and a
raw socket checks that the 403 body matches its Content-Length. It also
checks that an unblocked encoded-slash path still gets Tomcat's 400 and
that blocking a plain path is unchanged.

Simplify the Tomcat encoded-slash blocking test

Shares the blocked-path assertions in one helper, keeps the URI callback
records per test instance, and drops an unused toString().

review: pre-PR checks

- Pin encodedSolidusHandling=reject on the forked test connector, so the
  test always reaches the sendError(400) path it guards
- Mention the suspension check in the TomcatBlockingHelperTest Javadoc

Share the Jetty 12 BlockingException lookup between helpers

Compile Jetty 12 instrumentation against jetty-ee10-servlet 12.0.16

Complete a Jetty 12.1 ee10 async request suspended by a blocking response

Jetty 12.1 ServletChannelState.onError returns false for an ASYNC request without an AsyncListener and does nothing else, so a BlockingException thrown after startAsync() (e.g. ProxyServlet with RASP SSRF) left the connection hanging and the server span unfinished. Complete the request on onError exit when Jetty does not abort, the failure carries a BlockingException, no sendError is pending, the request is not aborted, async was started and the blocking response is committed.

Test completion of a Jetty 12 ee10 async request blocked after startAsync

Read the Jetty version inside the keep-alive test

Share the raw HTTP helpers of the Jetty 12 ee10 forked tests

Reuse the shared body reader in the async blocking test

review: pre-PR checks

- Complete the suspended request only when AppSec initiated and committed the blocking response
- Keep the Jetty 12.1 onError explanation once, on JettyAsyncBlockCompletion
- Make JettyBlockingExceptions package-private again
- Collapse the nested catch in JettyAsyncBlockCompletion
- Test that an uncommitted BlockingException after startAsync() is not completed
- Rename the keep-alive test to match what it checks on Jetty 12.0

Merge branch 'master' into APPSEC-71826

Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
(cherry picked from commit 98a3b29)
@jandro996
jandro996 requested review from a team as code owners November 20, 2026 08:58
@jandro996 jandro996 added this to the 1.69.1 milestone Nov 20, 2026
@jandro996 jandro996 added type: bug fix Bug fix comp: asm waf Application Security Management (WAF) inst: jetty Jetty instrumentation labels Nov 20, 2026
@jandro996
jandro996 requested review from PerfectSlayer, ValentinZakharov, cecile75 and manuel-alvarez-alvarez and removed request for a team November 20, 2026 08:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T09:02:30.122959Z d8fbb51 PR opened
🔒 Security Review ✅ Completed 2026-11-20T09:03:59.301472Z d8fbb51 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jandro996
jandro996 enabled auto-merge (squash) November 20, 2026 09:03

@datadog-prod-us1-5 datadog-prod-us1-5 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

The AppSec blocking backports received complete static file coverage with no reportable findings. Runtime behavior and the PR description’s end-to-end validation results were not independently verified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit d8fbb51

@PerfectSlayer PerfectSlayer left a comment

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.

Not a fan of backporting multiple multiple PRs into one but I see the point (take more than a day to backport all of them…).

That is why they ship in a single PR instead of one PR each.

Keep in mind you would have to fix the changelog manually to re-include them separately.

@jandro996

Copy link
Copy Markdown
Member Author

Not a fan of backporting multiple multiple PRs into one but I see the point (take more than a day to backport all of them…).

That is why they ship in a single PR instead of one PR each.

Keep in mind you would have to fix the changelog manually to re-include them separately.

Yes, sorry for that :(

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 75.86%
• Overall Coverage: 58.14% (-2.06%)

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

@dd-octo-sts

dd-octo-sts Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.87 s 14.74 s [+0.2%; +1.6%] (maybe worse)
startup:insecure-bank:tracing:Agent 13.66 s 13.70 s [-1.0%; +0.4%] (no difference)
startup:petclinic:appsec:Agent 17.20 s 17.19 s [-1.1%; +1.2%] (no difference)
startup:petclinic:iast:Agent 17.05 s 16.48 s [-0.9%; +7.9%] (no difference)
startup:petclinic:profiling:Agent 16.62 s 16.88 s [-2.4%; -0.7%] (maybe better)
startup:petclinic:sca:Agent 17.16 s 16.55 s [-0.7%; +8.1%] (no difference)
startup:petclinic:tracing:Agent 15.85 s 16.20 s [-6.2%; +1.8%] (no difference)

Commit: d8fbb510 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@jandro996
jandro996 merged commit 797bef5 into release/v1.69.x Nov 20, 2026
686 of 696 checks passed
@jandro996
jandro996 deleted the alejandro.gonzalez/backport-1.69.1 branch November 20, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: asm waf Application Security Management (WAF) inst: jetty Jetty instrumentation type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants