feat(middleware): add a hook to inspect HTTP responses - #3074
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
e676146 to
b4aded6
Compare
b4aded6 to
cf6faa7
Compare
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
cf6faa7 to
bdfa18c
Compare
|
🌿 Preview your docs: https://nvidia-preview-pr-3074.docs.buildwithfern.com/openshell |
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
|
Label |
pimlock
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
This implementation is project-valid under accepted issue #2691, and the initial full-diff review found one blocking fail-open correctness issue. The response middleware, relay coverage, and Fern documentation otherwise align with the intended response-hook path.
Action required: update the response fallback so valid but middleware-unrepresentable responses obey each selected stage's on_error policy, then push a new head for a delta review.
Blocking findings:
GATOR-150ae32b-01: valid responses can become unconditional 502 failures even when every selected response stage isfail_open.
Carried findings:
- None
Non-blocking suggestions:
- None
Gator metadata
- Validation: Implements the accepted HTTP response middleware work in #2691 and builds on merged #3072 and #3073.
- Docs: Relevant Fern documentation and operator-facing skill guidance are updated.
- Checks: DCO and currently dispatched standard checks are green; required E2E has not run for this head.
- E2E:
test:e2eis applied, but the label-help workflow requires a maintainer to re-run all jobs after review feedback is resolved. - Head SHA:
150ae32b4293654b34ab83f71fd01c3e647490aa - Base SHA:
48c449d8c80b8ad0201d24bef5c2ece3be233580 - Merge base SHA:
48c449d8c80b8ad0201d24bef5c2ece3be233580 - Patch ID:
274606ce582cd5701da75ddda5ae6c71452240d2 - Gator payload:
8 - Review mode:
initial - Previous reviewed SHA: none
- Review budget exhausted: no
- Maintainer decision required: no
- Next state:
gator:in-review
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
pimlock
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
The follow-up delta fixes the fail-open response fallback: valid responses that cannot fit the middleware protocol now follow each selected stage's on_error policy, while malformed or unsafe HTTP remains fail closed. No blocking findings remain, and the addressed review thread is resolved.
Blocking findings:
- No blocking findings remain
Carried findings:
GATOR-150ae32b-01: resolved by the current head; obs-text and envelope-limit coverage now verifies both fail-open passthrough and fail-closed 502 behavior.
Gator metadata
- Validation: Implements accepted issue #2691 and builds on merged #3072 and #3073.
- Docs: Fern middleware documentation and sandbox architecture guidance cover the corrected behavior.
- Checks: Current-head required checks are queued or running; completed DCO and Trivy gates are green.
- E2E:
test:e2eis applied and the current-head E2E workflow/check is dispatched. - Head SHA:
408382aa75381855ff8df0fdff684a7de7a3a0eb - Base SHA:
48c449d8c80b8ad0201d24bef5c2ece3be233580 - Merge base SHA:
48c449d8c80b8ad0201d24bef5c2ece3be233580 - Patch ID:
b646c493d45e19d8519c2edc648f93d782498570 - Gator payload:
8 - Review mode:
follow_up - Previous reviewed SHA:
150ae32b4293654b34ab83f71fd01c3e647490aa - Review budget exhausted: no
- Maintainer decision required: no
- Next state:
gator:watch-pipeline
Summary
Let configured middleware inspect, transform, or block upstream HTTP responses before they reach the sandbox. This implements the response hook defined in #3073, including whole-body inspection that can withhold a response and streaming inspection that can stop further delivery.
State-machine walkthrough: diagrams and transition tables explain middleware channel lifetime, fail-open/fail-closed behavior,
skip_remaining, and the HTTP commitment boundary.Related Issue
Part of #2691. Builds on merged #3072 and #3073.
Changes
skip_remainingand fail-open disable only the current stage while later stages continue. A valid block stops the response regardless of failure policy.Testing
Live middleware test results and performance measurements: single-stage and mixed-mode chains, body modes and actions, measured overhead, and Content-Length fix validation.
Validation reported for the implementation:
mise run pre-commitpassed.cargo test --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml --offline.mise run testandmise run ci.Checklist