Skip to content

Add block-outcome telemetry to Grizzly, Jetty, Liberty, Spring-webmvc, Undertow and Akka-http - #12527

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 8 commits into
masterfrom
block-telemetry-3
Oct 7, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 8 commits into
masterfrom
block-telemetry-3

Conversation

@jandro996

@jandro996 jandro996 commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

What Does This Do

Wires block-outcome telemetry (AppSecContext.reportBlockFailure()) into the six remaining
frameworks: Grizzly, Jetty, Liberty, Spring-webmvc, Undertow, and Akka-http. Follows the canonical
pattern already established for Netty (#12316) and Tomcat (#12493): resolve the
BlockResponseFunction, attempt the commit through tryCommitBlockingResponse(...), and on
false (or on exception) report the failure via AppSecContext - resolved through
RequestContext#getData(RequestContextSlot.APPSEC) + an instanceof check, never a direct cast to
AppSecRequestContext.

  • Wires the report check at every tryCommitBlockingResponse call site across:
    grizzly-2.0, grizzly-http-2.3.20, jetty-appsec-{7.0,8.1.3,9.2,9.3,9.4,11.0},
    jetty-server-{7.0,7.6,9.0,9.0.4,9.3,9.4.21,10.0,11.0}, liberty-{20.0,23.0},
    spring-webmvc-{3.1,6.0}, undertow-2.0 and akka-http-10.0
  • Adds UnmarshallerHelpersBlockFailureTest (JUnit 5) covering all branches of
    UnmarshallerHelpers.tryBlock: block committed, block failed, no BlockResponseFunction,
    foreign/null AppSec slot
  • Widens UnmarshallerHelpers.tryBlock visibility via @VisibleForTesting instead of a
    package-private comment, matching the existing repo convention

Follow-up: try/catch wrapper helpers for Undertow, Liberty and Spring-webmvc

A round of Codex review on this PR surfaced call sites where an exception thrown while committing
the blocking response was swallowed by the advice's suppress = Throwable.class before it ever
reached reportBlockFailure() - so a genuine commit failure went unreported whenever the commit
itself threw, as opposed to returning false cleanly. Fixed by introducing a small per-module
wrapper (FormDataContentHelper in Undertow, LibertyBlockingHelper in Liberty,
SpringBlockingHelper in Spring-webmvc x2) that calls tryCommitBlockingResponse(RequestContext, RequestBlockingAction) inside an explicit try/catch, reports the failure on either a caught
exception or a clean false, and returns a boolean the caller can trust. Spring-webmvc's
HttpMessageConverterInstrumentationTest was updated to assert notThrown(BlockingException) (not
thrown) on a clean commit failure, since the advice now correctly skips throwing when
tryCommitBlockingResponse returns false.

Follow-up: additional unguarded paths found by Codex (Grizzly, Jetty, Liberty)

Three more rounds of Codex review surfaced gaps in frameworks that have more than one independent
blocking-commit code path (request-intake vs. response-header), or where post-commit bookkeeping
needed to be separated from the actual commit attempt:

  • Grizzly (GrizzlyBlockingHelper.block(...)): the response-commit steps and the post-commit
    bookkeeping (effectivelyBlocked(), SpanClosingListener.onAfterService(...)) are now in two
    separate try/catch blocks. The first reports block_failure on exception; the second still
    catches (so a bookkeeping failure can't leak past the advice's suppress = Throwable.class) but
    does NOT report block_failure, since the response was already committed successfully by that
    point.
  • Jetty 9.0.4, 9.3, 9.4.21 and 10.0: these versions block via a separate response-header path
    (JettyCommitResponseHelper -> JettyOnCommitBlockingHelper.block(...)) that the rest of the
    jetty-appsec/jetty-server call sites never touch. Added the missing !success ->
    reportBlockFailure() branch there too. No new automated test: forcing
    JettyOnCommitBlockingHelper.block(...) to return false deterministically needs a
    reflection/MethodHandle-init failure across 4 distinct Jetty-version internals, which isn't
    practical without a brittle test tied to Jetty-version internals - documented as an accepted
    coverage gap.
  • Liberty 20.0 and 23.0: response-header-triggered blocking goes through
    HttpInboundServiceContextImplInstrumentation.SyncAdviceBuffer -> syncBufferEnter() directly,
    bypassing the parameter/body wrapper above entirely. Added the same guarded-exception reporting
    to that path's commit attempt (thiz.reinit()/thiz.finishResponseMessage()).

Known gap: several BlockResponseFunction implementations still cannot signal a genuine commit failure

  • Grizzly, Jetty: still exhibit the original limitation described below, and a follow-up audit
    found call sites (Grizzly's ParsedBodyParametersInstrumentation, six files under
    jetty-appsec-{7.0,9.2,9.3,9.4,11.0}) that discard the boolean returned by
    tryCommitBlockingResponse and unconditionally report failure regardless of the actual outcome,
    plus a JettyBlockingHelper.block() that catches Throwable and still returns true
    unconditionally. None of this has been fixed in this PR - it needs its own follow-up under
    APPSEC-62696, tracked separately from the try/catch wrapper fix above.
  • Undertow, Liberty: the underlying BlockResponseFunction implementation still always returns
    true after a genuine commit attempt regardless of whether the commit actually succeeded (the
    only reachable false values are pre-attempt guards: missing reflection handle, no active span,
    wrong request/response type, process-wide init state). This PR's wrapper helpers do make
    reportBlockFailure() fire correctly on any exception thrown during the commit attempt, but a
    commit that returns cleanly without throwing is still assumed to have succeeded.
  • Akka-http: AkkaBlockResponseFunction.tryCommitBlockingResponse returning true means the
    RequestBlockingAction was stashed for later use, not that the HTTP response was committed. The
    actual response substitution happens out-of-band via maybeCreateAlternativeResponse(). This
    return value is structurally incapable of signaling a genuine commit failure.

Fixing the remaining Grizzly/Jetty gaps and the Undertow/Liberty/Akka-http structural limitations is
out of scope for this PR. It should be tracked as a separate tech-debt follow-up under APPSEC-62696.

Motivation

Part of APPSEC-62696: block-outcome telemetry, extending the pattern already shipped for Netty and
Tomcat to the remaining instrumented servers.

Additional Notes

  • The near-identical reportBlockFailure() wiring duplicated across the six frameworks is
    intentional: each module has its own BlockResponseFunction, classloader scope and bytecode
    discriminator, so no cross-module helper is introduced by design.
  • Advisory perf review found no merge-blocking findings: the added code is a single instanceof
    check plus a conditional method call on the existing commit-attempt path, not a new hot path.

Contributor Checklist

Jira ticket: APPSEC-62696

Note: Once your PR is ready to merge, add it to the merge queue by commenting /merge. /merge -c cancels the queue request. /merge -f --reason "reason" skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.

@jandro996 jandro996 added comp: asm waf Application Security Management (WAF) type: feature Enhancements and improvements tag: no release notes Changes to exclude from release notes labels Sep 16, 2026
@jandro996

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-21T17:35:52.525014Z 37df2f4 Manual request
🔒 Security Review ✅ Completed 2026-09-21T17:39:26.025306Z 37df2f4 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: ff0f114442

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: ff0f114442

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

@datadog-official

datadog-official Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 68.82% (+9.54%)

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

@dd-octo-sts

dd-octo-sts Bot commented Sep 16, 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.05 s 13.96 s [-0.2%; +1.4%] (no difference)
startup:insecure-bank:tracing:Agent 12.96 s 12.99 s [-0.9%; +0.4%] (no difference)
startup:petclinic:appsec:Agent 17.24 s 16.98 s [+0.7%; +2.4%] (maybe worse)
startup:petclinic:iast:Agent 17.01 s 17.02 s [-0.8%; +0.8%] (no difference)
startup:petclinic:profiling:Agent 16.68 s 16.69 s [-1.5%; +1.4%] (no difference)
startup:petclinic:sca:Agent 17.08 s 16.33 s [+0.4%; +8.8%] (maybe worse)
startup:petclinic:tracing:Agent 16.12 s 16.15 s [-1.1%; +0.8%] (no difference)

Commit: 811af3f5 · 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 changed the base branch from master to block-telemetry-2b September 17, 2026 09:04
@jandro996

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2b99081893

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 2b99081893

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

@jandro996

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: f2cbed27d7

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: f2cbed27d7

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

@jandro996

Copy link
Copy Markdown
Member Author

@codex review

@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: 6f02c3d270

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 6f02c3d270

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Base automatically changed from block-telemetry-2b to master September 18, 2026 08:31
@jandro996

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 79478d24fd

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 79478d24fd

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@jandro996
jandro996 marked this pull request as ready for review September 21, 2026 08:22
@jandro996
jandro996 requested review from a team as code owners September 21, 2026 08:22
@jandro996
jandro996 requested review from vandonr and removed request for a team September 21, 2026 08:22

@datadog-official datadog-official 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.

Datadog Autotest: PASS

More details

Blocking-response commit paths now report false results and caught exceptions. Successful blocking behavior stays unchanged.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit 79478d2 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@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: 79478d24fd

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

@jandro996

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 37df2f4d38

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 37df2f4d38

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

- Wire reportBlockFailure() at every BlockResponseFunction.tryCommitBlockingResponse
  call site across akka-http, grizzly, jetty (appsec + server), liberty, spring-webmvc
  and undertow, resolving AppSecContext via RequestContextSlot.APPSEC instead of
  casting directly to AppSecRequestContext
- Add UnmarshallerHelpersBlockFailureTest covering all branches of
  UnmarshallerHelpers.tryBlock (block committed, block failed, no BRF, foreign/null
  AppSec slot)
- Widen UnmarshallerHelpers.tryBlock visibility via @VisibleForTesting instead of a
  package-private comment
Replace the repeated inline pattern (commit blocking response, then
manually check AppSecContext and call reportBlockFailure() on failure)
with the new BlockResponseFunction.tryCommitBlockingResponse(RequestContext,
Flow.Action.RequestBlockingAction) default overload added in
block-telemetry-2b (#12519). That overload already performs the
AppSecContext lookup and reportBlockFailure() call internally, so call
sites only need to pass the RequestContext instead of the TraceSegment.

Applies to the 37 call sites identified as mechanically substitutable:
akka-http-10.0, grizzly-http-2.3.20, jetty-appsec (7.0, 8.1.3, 9.2, 9.3,
9.4, 11.0), jetty-server (7.0, 7.6), liberty (20.0, 23.0), spring-webmvc
(3.1, 6.0), and undertow-2.0. Excludes GrizzlyBlockingHelper (grizzly-2.0,
manual reflection-based commit) and jetty-server-9.0's
JettyCommitResponseInstrumentation (compound res && _committed.get()
condition, not mechanically equivalent to the new overload's plain
boolean return).
…nd Undertow

- Move Grizzly's post-commit span/listener calls inside the try/catch so
  failures there also trigger reportBlockFailure()
- Add missing !success reportBlockFailure() branch to Jetty's before() in
  9.0.4/9.3/9.4.21/10.0
- Wrap Undertow's tryCommitBlockingResponse calls in FormDataContentHelper to
  catch exceptions swallowed by the advice's suppress=Throwable.class
…lure reporting to commit errors

- FormDataParserInstrumentation (Undertow): wrap the doParse blocking-commit call
  with FormDataContentHelper.tryCommitBlockingResponse so a synchronous exception
  is still reported as a block failure instead of being swallowed by the advice's
  suppress = Throwable.class.
- GrizzlyBlockingHelper: split post-commit finalization (effectivelyBlocked,
  SpanClosingListener.onAfterService) into its own try/catch so a failure there
  no longer reports block_failure for a response that was already committed
  successfully.
- Check the boolean return of FormDataContentHelper.tryCommitBlockingResponse
  in Undertow's FormDataParserInstrumentation before throwing BlockingException,
  matching the existing MultiPartUploadHandlerInstrumentation pattern
- Add LibertyBlockingHelper.tryCommitBlockingResponse wrapper in liberty-20.0
  and liberty-23.0 to report block_failure when the commit itself throws
  (mirrors Undertow's FormDataContentHelper contract)
- Route ParsePostDataInstrumentation, ParseParametersInstrumentation and
  GetPartsInstrumentation (both Liberty modules) through the new wrapper and
  check its return value before treating the request as blocked
…aths

- Add SpringBlockingHelper (spring-webmvc-3.1 and spring-webmvc-6.0) wrapping
  BlockResponseFunction#tryCommitBlockingResponse to guarantee reportBlockFailure()
  is invoked even when the commit call throws.
- Route all 6 blocking call sites (HttpMessageConverter read/write,
  RequestMappingInfoHandlerMapping#handleMatch, UriTemplateVariablesHandlerInterceptor#preHandle,
  x2 modules) through the helper and only set/throw BlockingException when the
  commit actually succeeds.
- Fix HttpMessageConverterInstrumentationTest assertions that expected the old,
  unconditional-throw behavior.
…fferEnter

- LibertyBlockingHelper (liberty-20.0, liberty-23.0): report the block failure
  when thiz.reinit()/thiz.finishResponseMessage() throws during syncBufferEnter,
  matching the existing wrapper's behavior for the parameter/body callback path
@jandro996
jandro996 added this pull request to the merge queue Oct 7, 2026
@dd-octo-sts

dd-octo-sts Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-07 12:43:09 UTC ℹ️ Start processing command /merge


2026-10-07 12:43:13 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-10-07 14:00:42 UTC ℹ️ MergeQueue: This merge request was merged

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 7, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit f44c3b5 into master Oct 7, 2026
819 of 821 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the block-telemetry-3 branch October 7, 2026 14:00
@github-actions github-actions Bot added this to the 1.68.0 milestone Oct 7, 2026
zacharycmontoya pushed a commit that referenced this pull request Oct 7, 2026
…, Undertow and Akka-http (#12527)

Add block-outcome telemetry to blocking response helpers

- Wire reportBlockFailure() at every BlockResponseFunction.tryCommitBlockingResponse
  call site across akka-http, grizzly, jetty (appsec + server), liberty, spring-webmvc
  and undertow, resolving AppSecContext via RequestContextSlot.APPSEC instead of
  casting directly to AppSecRequestContext
- Add UnmarshallerHelpersBlockFailureTest covering all branches of
  UnmarshallerHelpers.tryBlock (block committed, block failed, no BRF, foreign/null
  AppSec slot)
- Widen UnmarshallerHelpers.tryBlock visibility via @VisibleForTesting instead of a
  package-private comment

Centralize block_failure reporting via BlockResponseFunction overload

Replace the repeated inline pattern (commit blocking response, then
manually check AppSecContext and call reportBlockFailure() on failure)
with the new BlockResponseFunction.tryCommitBlockingResponse(RequestContext,
Flow.Action.RequestBlockingAction) default overload added in
block-telemetry-2b (#12519). That overload already performs the
AppSecContext lookup and reportBlockFailure() call internally, so call
sites only need to pass the RequestContext instead of the TraceSegment.

Applies to the 37 call sites identified as mechanically substitutable:
akka-http-10.0, grizzly-http-2.3.20, jetty-appsec (7.0, 8.1.3, 9.2, 9.3,
9.4, 11.0), jetty-server (7.0, 7.6), liberty (20.0, 23.0), spring-webmvc
(3.1, 6.0), and undertow-2.0. Excludes GrizzlyBlockingHelper (grizzly-2.0,
manual reflection-based commit) and jetty-server-9.0's
JettyCommitResponseInstrumentation (compound res && _committed.get()
condition, not mechanically equivalent to the new overload's plain
boolean return).

Report block failure on unguarded exception paths in Grizzly, Jetty and Undertow

- Move Grizzly's post-commit span/listener calls inside the try/catch so
  failures there also trigger reportBlockFailure()
- Add missing !success reportBlockFailure() branch to Jetty's before() in
  9.0.4/9.3/9.4.21/10.0
- Wrap Undertow's tryCommitBlockingResponse calls in FormDataContentHelper to
  catch exceptions swallowed by the advice's suppress=Throwable.class

Guard remaining Undertow form-parse commit call and scope Grizzly failure reporting to commit errors

- FormDataParserInstrumentation (Undertow): wrap the doParse blocking-commit call
  with FormDataContentHelper.tryCommitBlockingResponse so a synchronous exception
  is still reported as a block failure instead of being swallowed by the advice's
  suppress = Throwable.class.
- GrizzlyBlockingHelper: split post-commit finalization (effectivelyBlocked,
  SpanClosingListener.onAfterService) into its own try/catch so a failure there
  no longer reports block_failure for a response that was already committed
  successfully.

Fix block_failure reporting gaps in Undertow and Liberty exception paths

- Check the boolean return of FormDataContentHelper.tryCommitBlockingResponse
  in Undertow's FormDataParserInstrumentation before throwing BlockingException,
  matching the existing MultiPartUploadHandlerInstrumentation pattern
- Add LibertyBlockingHelper.tryCommitBlockingResponse wrapper in liberty-20.0
  and liberty-23.0 to report block_failure when the commit itself throws
  (mirrors Undertow's FormDataContentHelper contract)
- Route ParsePostDataInstrumentation, ParseParametersInstrumentation and
  GetPartsInstrumentation (both Liberty modules) through the new wrapper and
  check its return value before treating the request as blocked

Fix block_failure reporting gaps in Spring-webmvc blocking response paths

- Add SpringBlockingHelper (spring-webmvc-3.1 and spring-webmvc-6.0) wrapping
  BlockResponseFunction#tryCommitBlockingResponse to guarantee reportBlockFailure()
  is invoked even when the commit call throws.
- Route all 6 blocking call sites (HttpMessageConverter read/write,
  RequestMappingInfoHandlerMapping#handleMatch, UriTemplateVariablesHandlerInterceptor#preHandle,
  x2 modules) through the helper and only set/throw BlockingException when the
  commit actually succeeds.
- Fix HttpMessageConverterInstrumentationTest assertions that expected the old,
  unconditional-throw behavior.

Report block_failure on Liberty direct response-commit path in syncBufferEnter

- LibertyBlockingHelper (liberty-20.0, liberty-23.0): report the block failure
  when thiz.reinit()/thiz.finishResponseMessage() throws during syncBufferEnter,
  matching the existing wrapper's behavior for the parameter/body callback path

Merge branch 'master' into block-telemetry-3

Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
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) tag: no release notes Changes to exclude from release notes type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants