fix: a page whose origin has no host is never told an address by accountsChanged (closes #564) #570

Merged
clawbot merged 1 commits from issue-564-opaque-origin-accounts-changed into next 2026-10-19 00:59:40 +02:00
Collaborator

When the user switches address, broadcastAccountsChanged() in src/background/index.js judges each tab by the origin of its URL, the only origin the background can see. A page its server sandboxes with a Content-Security-Policy has the origin null even at a connected site's URL. Since #560 every request from such a page is refused, yet it was still sent the new active address.

The background now names the origin it judged by on each accountsChanged event it sends there. The listener in src/content/index.js passes the address to the page only when the page's own window.origin is that origin, and an empty list otherwise. In a content script on both browsers, window.origin is the page's own origin, null on a sandboxed page; location.origin would give the URL's origin.

An accountsChanged that names no origin also reaches the page as an empty list. The only other sender, removal of a site in Settings, already sends one. chainChanged is unchanged.

One sentence added to the README's SiteApproval section says the same.

New file, in tests/: tests/accountsChangedOpaqueOrigin.test.js. It switches the address in the real background, takes the event sent to a tab at the site's URL, and hands it to the real content script in a page of the site's origin and in a page of origin null.

Judgement call: no browser-suite test was added; the unit test sets window.origin itself.

Model: opus-5-5

When the user switches address, `broadcastAccountsChanged()` in `src/background/index.js` judges each tab by the origin of its URL, the only origin the background can see. A page its server sandboxes with a Content-Security-Policy has the origin `null` even at a connected site's URL. Since https://git.eeqj.de/sneak/AutistMask/pulls/560 every request from such a page is refused, yet it was still sent the new active address. The background now names the origin it judged by on each `accountsChanged` event it sends there. The listener in `src/content/index.js` passes the address to the page only when the page's own `window.origin` is that origin, and an empty list otherwise. In a content script on both browsers, `window.origin` is the page's own origin, `null` on a sandboxed page; `location.origin` would give the URL's origin. An `accountsChanged` that names no origin also reaches the page as an empty list. The only other sender, removal of a site in Settings, already sends one. `chainChanged` is unchanged. One sentence added to the README's SiteApproval section says the same. New file, in `tests/`: `tests/accountsChangedOpaqueOrigin.test.js`. It switches the address in the real background, takes the event sent to a tab at the site's URL, and hands it to the real content script in a page of the site's origin and in a page of origin `null`. Judgement call: no browser-suite test was added; the unit test sets `window.origin` itself. Model: opus-5-5
clawbot added 1 commit 2026-10-19 00:24:06 +02:00
fix: a page whose origin has no host is never told an address by accountsChanged (closes #564)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
d79d48f6ec
On an address switch the background judges each tab by the origin of its URL. A page its server sandboxes has the origin "null" at a connected site's URL, and was sent the new active address. The background now names the origin it judged by on each accountsChanged event, and the content script passes the address on only when the page's own origin (window.origin) is that one; otherwise the page gets an empty list.

Model: opus-5-5
clawbot added the needs-review label 2026-10-19 00:24:08 +02:00
clawbot self-assigned this 2026-10-19 00:24:09 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit fc042c3191 into next 2026-10-19 00:59:40 +02:00
clawbot deleted branch issue-564-opaque-origin-accounts-changed 2026-10-19 00:59:40 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#570