Gateway: allow extension origins in browser allowlist#44
Open
BingqingLyu wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Describe the problem and fix in 2–5 bullets:
gateway.controlUi.allowedOriginscould not explicitly allowlistchrome-extension://<id>because the origin checker normalized extension origins throughURL.origin, which becomes"null"for that scheme.["*"]to get through browser-origin WS checks, which weakened the intended hardening.scheme://hostmatching for non-standard origins, sochrome-extension://<id>can be allowlisted exactly; focused unit and handshake tests were added.Origin: null, no changes to token/device auth, host-header fallback, or non-browser client auth behavior.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
gateway.controlUi.allowedOriginscan now contain exact extension origins such aschrome-extension://abcdefghijklmnop, and those browser-origin Gateway WS connects will succeed when otherwise authenticated.["*"]solely to let a Chrome extension sidepanel client connect.http(s)origins, wildcard behavior, host-header fallback, and literalOrigin: nullrejection remain unchanged.Security Impact (required)
No(strictly speaking this allows chrome extensions/electron+tauri apps to connect but I think calling it a new capability is a stretch)NoNoNoNoYes, explain risk + mitigation:N/ARepro + Verification
Environment
wsgateway.auth.mode="token",gateway.controlUi.allowedOrigins=["chrome-extension://abcdefghijklmnop"]Steps
gateway.controlUi.allowedOrigins=["chrome-extension://abcdefghijklmnop"].Origin: chrome-extension://abcdefghijklmnopand a validconnectrequest.Expected
https://...origin.Actual
origin not allowedbecause the checker collapsed the extension origin to"null"internally.hello-ok.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
app://,tauri://)Compatibility / Migration
YesNoNoN/AFailure Recovery (if this breaks)
gateway.controlUi.allowedOrigins=["*"]until the regression is understood.src/gateway/origin-check.ts; optionally restore priorgateway.controlUi.allowedOriginsvalues in config.chrome-extension://<id>still being rejected; malformed/non-matching non-standard origins unexpectedly being accepted; regressions in existinghttp(s)origin allowlisting.