Skip to content

fix(gateway): use verified proxy identity for response history - #118607

Merged
steipete merged 1 commit into
mainfrom
codex/qa0803-gateway-proxy-response-identity
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa0803-gateway-proxy-response-identity

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary\n- Preserve the verified authenticated user at the existing Gateway HTTP authentication boundary.\n- Bind previous_response_id continuation to verified trusted-proxy identity instead of an unrelated forwarded bearer.\n- Preserve token and password authentication, local fallback, operator access, and explicit session selectors.\n\n## Verification\n- Existing real Gateway integration first reproduced two proxy identities colliding through the same incidental bearer.\n- Responses integration, auth-owner, and authentication fallback suites: 79 passed.\n- The same verified user retains continuation even when its unrelated forwarded bearer changes.\n- Independent structured security autoreview: clean, confidence 0.97.

@steipete
steipete requested a review from a team as a code owner August 3, 2026 09:28
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 5:34 AM ET / 09:34 UTC.

ClawSweeper review

What this changes

The PR preserves the verified trusted-proxy user on the Gateway request and uses it to scope OpenResponses continuation history.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal security-owner review and current-head CI. The patch fixes a current-main response-history isolation bug by carrying the trusted-proxy identity that authentication already verified, rather than hashing an unrelated forwarded bearer.

Priority: P1
Reviewed head: bcc066c3418c35ddd0ecbe7f376eb795376baf44

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-aligned security fix with a direct Gateway integration regression test and sufficient reported behavior proof.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body reports the before/after Gateway integration result and 79 passing focused suites, and the supplied check context records a successful Real behavior proof check.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body reports the before/after Gateway integration result and 79 passing focused suites, and the supplied check context records a successful Real behavior proof check.
Evidence reviewed 6 items Current-main defect: Current main derives the response-history subject from any bearer header before considering trusted-proxy identity, so two proxy-authenticated users carrying the same incidental forwarded bearer can match the same continuation scope.
Verified identity contract: Trusted-proxy authorization rejects untrusted sources and missing user headers, trims the configured user header, and returns it as the successful authentication result; the PR carries that result across the existing HTTP authorization boundary.
Patch follows the owner boundary: The branch adds the authenticated user to AuthorizedGatewayHttpRequest and uses it only when the request was authenticated as trusted-proxy, leaving token/password bearer scoping and the generic gateway-auth fallback intact.
Findings None None.
Security None None.

How this fits together

Gateway HTTP authentication validates the proxy source and its configured user header before the OpenResponses endpoint handles a request. OpenResponses then uses an authentication-and-agent scope to decide whether a previous response may continue an existing session.

flowchart LR
  Client[OpenResponses client] --> Proxy[Trusted proxy headers]
  Proxy --> Auth[Gateway authentication]
  Auth --> Identity[Verified proxy user]
  Identity --> Scope[Response history scope]
  Scope --> Continuation[Prior response session]
Loading

Before merge

  • Resolve merge risk (P1) - This changes a Gateway authentication boundary covered by security code ownership, so it should land only after the required owner review and current-head checks complete.
  • Complete next step (P2) - This is a protected maintainer-labeled authentication-boundary PR with no mechanical repair remaining; route it through security-owner review and the normal current-head merge gates rather than opening a competing fix PR.
Agent review details

Security

None.

PR surface

Source +4, Tests +51. Total +55 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 11 7 +4
Tests 2 51 0 +51
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 62 7 +55

Review metrics

Metric Value Why it matters
Production versus regression coverage production +11/-7; tests +51/-0 The small production increase is justified by preserving the verified authentication fact at its owner boundary; the added integration coverage exercises both allowed and denied continuation paths.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused owner-boundary repair after security-owner review, preserving the verified proxy identity as the sole trusted-proxy continuation subject and retaining the existing token/password fallback behavior.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the focused owner-boundary repair after security-owner review, preserving the verified proxy identity as the sole trusted-proxy continuation subject and retaining the existing token/password fallback behavior.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible with high confidence: current main prioritizes the bearer-derived scope, and the added Gateway integration scenario demonstrates the same bearer serving Alice and Bob under different verified proxy identities.

Is this the best way to solve the issue?

Yes. Carrying the already-verified authentication result across the existing request boundary is the narrowest maintainable fix; re-reading forwarded headers in OpenResponses would duplicate trust validation and risk drift.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ecc49b5a870b.

Labels

Label changes:

  • add P1: Current main can associate two trusted-proxy users with the same response history when an incidental forwarded bearer collides, exposing a broken Gateway workflow with privacy implications.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports the before/after Gateway integration result and 79 passing focused suites, and the supplied check context records a successful Real behavior proof check.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports the before/after Gateway integration result and 79 passing focused suites, and the supplied check context records a successful Real behavior proof check.

Label justifications:

  • P1: Current main can associate two trusted-proxy users with the same response history when an incidental forwarded bearer collides, exposing a broken Gateway workflow with privacy implications.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports the before/after Gateway integration result and 79 passing focused suites, and the supplied check context records a successful Real behavior proof check.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports the before/after Gateway integration result and 79 passing focused suites, and the supplied check context records a successful Real behavior proof check.

Evidence

What I checked:

  • Current-main defect: Current main derives the response-history subject from any bearer header before considering trusted-proxy identity, so two proxy-authenticated users carrying the same incidental forwarded bearer can match the same continuation scope. (src/gateway/openresponses-http.ts:132, ecc49b5a870b)
  • Verified identity contract: Trusted-proxy authorization rejects untrusted sources and missing user headers, trims the configured user header, and returns it as the successful authentication result; the PR carries that result across the existing HTTP authorization boundary. (src/gateway/auth.ts:284, ecc49b5a870b)
  • Patch follows the owner boundary: The branch adds the authenticated user to AuthorizedGatewayHttpRequest and uses it only when the request was authenticated as trusted-proxy, leaving token/password bearer scoping and the generic gateway-auth fallback intact. (src/gateway/openresponses-http.ts:127, bcc066c3418c)
  • Regression coverage: The Gateway integration test proves that Alice retains continuation when only an unrelated forwarded bearer changes, while Bob cannot reuse Alice's response ID despite presenting the original bearer. (src/gateway/openresponses-http.test.ts:1868, bcc066c3418c)
  • Feature provenance: The branch commit is a focused follow-up in the same Gateway/OpenResponses area; recent current-main history also includes verified-owner and Responses-session maintenance by the same contributor. (src/gateway/openresponses-http.ts:127, bcc066c3418c)
  • Security ownership: Gateway authentication helper paths are assigned to the security code-owner team, so this focused fix should receive that normal owner review before landing. (.github/CODEOWNERS:31, ecc49b5a870b)

Likely related people:

  • steipete: Current-main blame on the affected response-scope and authorization code resolves to Peter Steinberger, and recent history includes the earlier verified-owner fix plus this focused follow-up. (role: recent Gateway and OpenResponses contributor; confidence: high; commits: 3aca283d4452, 3af65a371c8e, bcc066c3418c; files: src/gateway/openresponses-http.ts, src/gateway/http-auth-utils.ts, src/gateway/auth.ts)
  • openclaw/openclaw-secops: CODEOWNERS assigns Gateway authentication helper files to this team; the patch carries verified identity through that boundary. (role: security code owner; confidence: high; files: src/gateway/http-auth-utils.ts, .github/CODEOWNERS)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit a9da10e into main Aug 3, 2026
199 of 209 checks passed
@steipete
steipete deleted the codex/qa0803-gateway-proxy-response-identity branch August 3, 2026 10:20
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant