Repository navigation
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed September 28, 2026, 10:13 PM ET / September 29, 2026, 02:13 UTC (Revision 10). ClawSweeper reviewWhat this changesThe branch adds a browser-Origin check to Control UI plugin-cookie authentication and route tests for cross-site, opaque, and absent Origins. Merge readiness⛔ Blocked before merge - 9 items remain Current main still lacks the cookie-path Origin check, so this PR addresses a real gap. The proposed gate blocks concrete cross-site Origins, but a prior locality defect remains and the security boundary for opaque or absent Origins needs an explicit decision. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway issues signed cookies so sandboxed Control UI plugin tabs can request protected plugin routes. HTTP authentication checks each request before the Gateway dispatches it to a plugin handler. flowchart LR
A[Plugin tab or other browser] --> B[HTTP request with cookie]
B --> C[Gateway cookie validation]
C --> D[Browser Origin gate]
D --> E[Plugin route authorization]
E --> F[Plugin handler]
Decision needed
Why: Rejecting those requests can break the default sandbox, while accepting them leaves a known browser route around the proposed Origin check; the contributor cannot choose that boundary for maintainers. Before merge
Findings
Agent review detailsSecurityNeeds attention: The patch narrows one CSRF path but leaves an acknowledged opaque-origin route and omits a locality input needed by the shared validator. PR surfaceSource +58, Tests +121. Total +179 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use verified request locality in the shared Origin check, prove the decision at the plugin handler, and have the security owner choose a frame-bound authorization contract or explicitly accept this narrower hardening while keeping the linked issue open. Do we have a high-confidence way to reproduce the issue? Yes for the source-level gap: current main authorizes a valid plugin cookie without checking Origin. The PR's supplied trace compares direct authorization results, but no browser-to-handler reproduction is shown. Is this the best way to solve the issue? Unclear. Reusing the shared Origin validator is a narrow improvement, but it needs verified request locality and a maintainer-approved answer for opaque-frame authority. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e380838e4665. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
1980f0b to
535745f
Compare
535745f to
78da8ac
Compare
78da8ac to
a5dfaa3
Compare
|
a5dfaa3 to
73751f2
Compare
73751f2 to
4fd398b
Compare
|
CI failure attribution on head |
|
Thanks @miorbnli for identifying and documenting this gap. Closing this partial implementation after security review: the |
Closes #116241
What Problem This Solves
Fixes the primary CSRF vector: a cross-site HTTPS page with a concrete
Origin(e.g.https://attacker.example) could present a victim'sSameSite=Noneplugin cookie and the gateway would authorize without checking Origin.Why This Change Was Made
The cookie path skipped Origin validation entirely. The bearer path's
checkBrowserOriginrejectsOrigin: null, which the default plugin-tab sandbox (sandbox="allow-scripts"withoutallow-same-origin, confirmed atui/src/lib/chat/tool-display.ts:248) emits. This PR adds a gate that rejects concrete cross-site Origins while acceptingOrigin: nullto preserve the sandbox iframe.Requires maintainer decision:
Origin: nullis not an identity — an attacker can also create an opaque sandbox. A capability-bound frame authorization mechanism is needed to distinguish the intended plugin tab from attacker-controlled opaque contexts. This is a security/product design decision for@openclaw/openclaw-secops. This PR closes the concrete cross-site Origin vector (the primary reported attack path) but does not close the opaque-origin variant.User Impact
Cross-site pages with a concrete
Origincan no longer use a victim's plugin-tab cookie. The sandboxed plugin-tab iframe continues to work. Non-browser clients are unaffected.Evidence
5a826aa18d3| Head:a5dfaa3fb794.19.112-2.el8.x86_64, Nodev26.5.0Real gateway auth before/after proof
A real signed Control-UI plugin cookie was minted via the production
setControlUiPluginAuthCookie, thenauthorizeControlUiPluginCookieRequestwas called with different Origin/Sec-Fetch-Site combinations:Before: on current main, a valid cookie +
Origin: https://attacker.example.testauthorizes the request (blind CSRF). All Origins pass because there is no Origin check.After: concrete cross-site Origins are blocked. The default sandbox iframe (
Origin: null) continues to work. Non-browser clients (no Origin) pass through.Focused tests (re-run after rebase onto main
5a826aa18d3)node scripts/run-vitest.mjs src/gateway/server.plugin-frame-auth.test.ts-> 17 tests passednode_modules/.bin/oxlint-> 0 warnings, 0 errorsTest coverage
Cross-site concrete Origin → 401; null Origin + same-origin → 200; null Origin + cross-site → 200 (sandbox default); null Origin + no Fetch Metadata → 200; no Origin → 200.
Sandbox embed mode
Default sandbox mode confirmed from source:
resolveEmbedSandbox(ui/src/lib/chat/tool-display.ts:248) returns"allow-scripts"for the default case → opaque origin →Origin: null.Not tested / known limitation
Full browser-to-gateway round trip with a real sandboxed iframe. The null-Origin path accepts opaque sandbox requests that an attacker could also create. A capability-bound frame authorization mechanism is needed for complete protection — requires maintainer decision on #116241.
Rebased onto current
main(26505c528b5, heada5dfaa3fb79): clean rebase, no semantic conflicts. The prior CI red shards (copilotregistry.contract.test.ts,bash-executorfault-small, image-tool compression policy) ran against a merge tree that is now 1,400+ commits behind current main; focused suite re-verified on the new head:server.plugin-frame-auth.test.ts17/17,pnpm tsgoexit 0, line-cap and assertion-safety ratchets OK.Maintainer security disposition (2026-10-31)
Closing this partial implementation under the scoped contributor-PR review; the underlying issue #116241 remains open.
Current main
10f6426f1ecbe389b7fcba70c790bf53e064becdstill admits cookie-authenticated plugin reads without an Origin check. A temporary regression through the real Gateway HTTP dispatcher reproduced a concrete attacker Origin returning 200 instead of 401 (9 existing tests passed; diagnostic failed as intended, 51.74 seconds). No browser-readable disclosure was tested.The default opaque-frame contract was deliberately introduced by #107323, commit
efa8075c6831faf8400e6bc40c4f52f401d449d2. It remains in the cookie owner and default sandbox policy. Strictly applying the existingresolveAcceptedBrowserOriginowner would reject supported opaque-frame requests carryingOrigin: null. Allowing null retains the indistinguishable attacker-controlled sandbox request.Sec-Fetch-Site: cross-sitedoes not establish frame identity.Source-derived matrix, assuming an otherwise valid cookie and authorized GET/HEAD route:
Origin: null,Sec-Fetch-Site: cross-siteSec-Fetch-Site: cross-siteA compatible complete defense needs authorization that distinguishes the intended frame from other opaque contexts. That exceeds this small Origin-gate takeover. The concrete-Origin regression and reuse of the existing origin owner remain useful for that work. No replacement or production change was published; contributor code was read through GitHub only and was not executed.
Independent security review confirmed this conflict. Requested autoreview (Codex, P0-P2) completed on the diagnostic change plus the unchanged auth/origin/cookie/sandbox owners: no actionable findings in that selected scope; it explicitly confirmed that this is a failing diagnostic, not a production fix.