fix: allow custom control UI origins#73511
fix: allow custom control UI origins#73511ishangodawatta wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes allowlist matching for custom-scheme browser origins (e.g. Confidence Score: 5/5Safe to merge — targeted fix with correct logic and no security regressions. The change is minimal and well-reasoned: it correctly handles the WHATWG URL No files require special attention. Reviews (1): Last reviewed commit: "fix: allow custom control UI origins" | Re-trigger Greptile |
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Current main plus the Node URL check gives a high-confidence reproduction: Next step before merge Security Review detailsBest possible solution: Land this narrow Gateway normalization fix after maintainer review, refreshed changelog placement, and green validation, while preserving explicit allowlist enforcement for custom-scheme origins. Do we have a high-confidence way to reproduce the issue? Yes. Current main plus the Node URL check gives a high-confidence reproduction: Is this the best way to solve the issue? Yes. Reconstructing Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a53be2d2ce8c. |
d01ea64 to
36d0bdb
Compare
36d0bdb to
5d19030
Compare
Summary
gateway.controlUi.allowedOriginscan include a custom desktop-app origin liketauri://localhost, but the gateway normalises that browserOriginheader to the opaquenullorigin and never matches the explicit allowlist entry.scheme://hostorigin for non-special URL schemes when the browser sends a scheme and host, then continue matching through the existing lower-case allowlist path.Origin: nullremains rejected, unlisted custom origins remain rejected, and host-header/local-loopback fallbacks keep their existing rules.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
new URL("tauri://localhost").originreturns the opaque stringnull, so exact allowlist matching comparestauri://localhostwithnull.Regression Test Plan (if applicable)
src/gateway/origin-check.test.tsUser-visible / Behavior Changes
Operators can set
gateway.controlUi.allowedOriginsto values liketauri://localhostwithout using*for desktop Control UI wrappers.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: N/A. This keeps explicit allowlist matching required for non-wildcard custom-scheme origins.Repro + Verification
Environment
gateway.controlUi.allowedOrigins = ["tauri://localhost"]Steps
gateway.controlUi.allowedOriginswithtauri://localhost.Origin: tauri://localhost.checkBrowserOriginbehaviour.Expected
Actual
new URL("tauri://localhost").originasnull, so the explicit allowlist entry does not match.Evidence
Local command evidence:
git diff --check HEAD~1..HEADpassed.tauri://LOCALHOST,electron://localhost,https://CONTROL.example.com, literalnull, and malformednot a urlcases.pnpm docs:listwas attempted but blocked by Corepack registry timeout while downloadingpnpm 10.33.0(UND_ERR_CONNECT_TIMEOUT).pnpm test src/gateway/origin-check.test.tsreached the repo test wrapper via cached pnpm but could not run because this worktree has novitestdependency and dependency installation is blocked by registry timeouts.Human Verification (required)
nulland malformed origins still return no parsed origin.Review Conversations
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations