You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cross-realm detection of Headers/Request in content script #8
src/injected.js runs in the content-script isolated world. Headers, Request, and Response constructors in the isolated world are different objects than the ones on the page. So:
headers instanceof Headers returns false for a Headers object the page created.
input instanceof Request returns false for a Request the page created.
The page's fetch is actually intercepted by nip98-interceptor.js (which runs in page realm), so the practical impact is limited — the injected.js fetch override only catches content-script-initiated fetches where objects share the isolated-world realm.
But the code is still technically incorrect and could misbehave if, for example, the extension ever intercepts a page-created Request via message passing or starts sharing objects across realms.
Proposed fix
Replace instanceof checks with cross-realm-safe alternatives:
Closing as moot. Re-audited against main at bd39ce8: src/injected.js no longer wraps fetch at all (the double interception was removed in #22, see the note at src/injected.js:5-8), so there are no instanceof Headers / instanceof Request checks left in the isolated world to get wrong.
The page-realm equivalent was checked too. A Headers object built in an iframe's realm fails instanceof in src/nip98-interceptor.js, Object.keys on it returns [], and Podkey then simply does not sign; the page's own auth is kept. That fails safe, so nothing to fix there either.
Activity
jjohare commentedon Nov 28, 2026
Closing as moot. Re-audited against
mainat bd39ce8:src/injected.jsno longer wrapsfetchat all (the double interception was removed in #22, see the note atsrc/injected.js:5-8), so there are noinstanceof Headers/instanceof Requestchecks left in the isolated world to get wrong.The page-realm equivalent was checked too. A
Headersobject built in an iframe's realm failsinstanceofinsrc/nip98-interceptor.js,Object.keyson it returns[], and Podkey then simply does not sign; the page's own auth is kept. That fails safe, so nothing to fix there either.Reopen if a cross-realm path comes back.