Gateway: allow extension origins in browser allowlist#38290
Conversation
Greptile SummaryThis PR fixes a bug where The fix introduces Key observations:
Confidence Score: 5/5
Last reviewed commit: e252c8a |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Codex deep review: this is still a valid current bug and this PR is the right narrow fix for exact Current main still compares Scope looks correct: this should close #52477 / #43596-style exact-origin failures. It intentionally does not implement scheme wildcards like One merge note: rebase onto current main before landing and keep the test names/fixtures aligned with the current |
|
Codex review: needs changes before merge. Reviewed July 9, 2026, 6:21 AM ET / 10:21 UTC. Summary PR surface: Source +21, Tests +41. Total +62 across 3 files. Reproducibility: yes. at source level. Current main compares configured origins against Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Land this or an equivalent current-main fix after keeping configured allowlist strings exact, accepting only hosted opaque incoming origins, rejecting hostless schemes, and preserving current private same-origin behavior. Do we have a high-confidence way to reproduce the issue? Yes at source level. Current main compares configured origins against Is this the best way to solve the issue? No, not yet. The parser layer is the right owner boundary, but the patch should keep configured allowlist values exact, reject hostless opaque schemes, and rebase over current main before merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e39e628a8416. Label changesLabel justifications:
Evidence reviewedPR surface: Source +21, Tests +41. Total +62 across 3 files. View PR surface stats
Security concerns:
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (18 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper PR egg 🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress. Hatch commandComment Hatchability rules:
What is this egg doing here?
|
|
This pull request has been automatically marked as stale due to inactivity. |
Co-authored-by: Volky <[email protected]>
|
Maintainer rewrite and proof complete at What this solves: browser extensions and desktop shells send hosted custom origins such as The final change keeps current Verification:
The PR body now documents the precise grant boundary and user impact. Contributor credit is preserved in the commit trailer. |
|
Merged via squash.
|
What Problem This Solves
Desktop shells and browser extensions send valid browser
Originvalues such astauri://localhost,electron://localhost,app://localhost, orchrome-extension://<id>. JavaScript's URL parser reportsURL.origin === "null"for these hosted non-standard schemes, so the Gateway could not match them against an exactgateway.controlUi.allowedOriginsentry. Operators were forced to choose between a broken app and the much broader"*"allowlist.Fixes #46520. Also covers the root cause reported in #35035.
Why This Change Was Made
The Gateway now derives
scheme://authorityonly for hosted schemes whose parsed origin is opaque, while retaining the standard serialized origin for HTTP(S). The raw input must first be an origin and nothing more: paths, queries, fragments, credentials, hostless schemes, dot-segment normalization, and backslash path separators are rejected before URL canonicalization.This is deliberately exact matching, not a scheme wildcard or prefix match.
tauri://localhostgrants only that origin; it does not granttauri://localhost/path, another authority,Origin: null, or arbitrary Tauri origins. Existing wildcard, private same-origin, tailnet, host-header fallback, token/device authentication, and local-loopback rules remain unchanged.User Impact
gateway.controlUi.allowedOrigins=["*"]solely because their desktop/browser shell uses a non-standard scheme.Evidence
tbx_01kx3a3cqcgztce1p3rc9wrqmp/ Actions 29014889369: 146/146 origin-validator and real Gateway browser-auth tests passed.tauri://localhostand rejects non-matching or malformed variants.file:,data:, wildcard, private same-origin, host fallback, and local-loopback behavior.git diff --checkand repository formatting passed.Compatibility / Recovery
Backward compatible for valid existing origins. Reverting the single Gateway origin-parser change restores prior behavior; no stored data or config migration is involved.
AI Assistance
Maintainer-refactored and reviewed with Codex. Contributor credit is preserved in the commit trailer.