A page with an opaque origin is treated as a site named null #527

Open
opened 2026-10-14 04:49:39 +02:00 by clawbot · 0 comments
Collaborator

Where. src/background/index.js:1428-1446 takes sender.origin as the site whenever it is a non-empty string.

What happens. A document with an opaque origin, such as a page its server sends with a sandbox Content-Security-Policy, is reported with the origin "null". The wallet accepts "null" as a site. Two things follow:

  • Every such document, from every website, is the same site. A connection remembered for "null" connects all of them with no prompt, and each of them can read the active address and raise signing prompts.
  • isPhishingDomain(extractHostname("null")) never matches, so a blocklisted domain that serves its pages this way gets no phishing banner on any approval screen.

Should. README SiteApproval: "A site is its full origin, scheme://host[:port]". A request whose origin is not one is refused like a request with no origin, with 4100.

Severity: minor

Definition of done

  • A request whose reported origin is "null", or anything else that is not scheme://host[:port], is refused with 4100 and opens no prompt.
  • A test in tests/rpcOrigin.test.js sends a request with sender.origin set to "null".

The review on #383 set opaque origins aside because content scripts do not run in sandboxed subframes. This is a different path: a top-level page sandboxed by its own header, which the manifests' content scripts match by its URL, as they match every page. Not run in a browser; read from the code and from the browser's documentation that sender.origin can be opaque.

Model: opus-5-5

**Where.** `src/background/index.js:1428-1446` takes `sender.origin` as the site whenever it is a non-empty string. **What happens.** A document with an opaque origin, such as a page its server sends with a `sandbox` Content-Security-Policy, is reported with the origin `"null"`. The wallet accepts `"null"` as a site. Two things follow: - Every such document, from every website, is the same site. A connection remembered for `"null"` connects all of them with no prompt, and each of them can read the active address and raise signing prompts. - `isPhishingDomain(extractHostname("null"))` never matches, so a blocklisted domain that serves its pages this way gets no phishing banner on any approval screen. **Should.** README SiteApproval: "A site is its full origin, `scheme://host[:port]`". A request whose origin is not one is refused like a request with no origin, with 4100. Severity: minor ## Definition of done - [ ] A request whose reported origin is `"null"`, or anything else that is not `scheme://host[:port]`, is refused with 4100 and opens no prompt. - [ ] A test in `tests/rpcOrigin.test.js` sends a request with `sender.origin` set to `"null"`. The review on https://git.eeqj.de/sneak/AutistMask/issues/383 set opaque origins aside because content scripts do not run in sandboxed subframes. This is a different path: a top-level page sandboxed by its own header, which the manifests' content scripts match by its URL, as they match every page. Not run in a browser; read from the code and from the browser's documentation that `sender.origin` can be opaque. Model: opus-5-5
clawbot self-assigned this 2026-10-14 04:49:39 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#527