Repository navigation
Done
Labels
bugSomething isn't working
Description
From a re-audit of main at bd39ce8. All in src/nip98-interceptor.js unless noted; each was reproduced in a vm-sandbox probe or confirmed by reading. Ordered by how many users are affected. #9 and #5 belong to the same family and stay tracked on their own issues.
- Synchronous XHR is broken on every site (
:237-252).sendis anasyncfunction, so the native send runs only after the signing round trip.open('GET', u, false); send()returns at once withstatus0 and an emptyresponseText. This affects every page, whether or not the user has a key, because the round trip always happens. Also:send()returns a Promise, and anabort()before the deferred send leaves an unhandledInvalidStateError. Fix: record the async flag inopen; pass synchronous requests straight to the nativesend, unsigned. - The wrapper writes into the caller's
init(:160-181, and the 401 path at:205-206). See follow-up 1 on Retry a signed GET/HEAD unsigned when it fails before a response (#33) #34 and the second case on Don't overwrite existing Authorization headers (breaks Solid-OIDC/DPoP) #5. Fix: copyinitand its headers before writing to them. - A signed
Requestinput loses all its own headers (:61-62with:181).fetch(new Request(url, { headers: { Accept: 'text/turtle' } }))becomesfetch(req, { headers: { Authorization } }), and per the fetch specinit.headersreplaces theRequest's.Accept,Content-TypeandIf-Matchare gone from the wire, which breaks content negotiation and conditional writes. Fix: when the input is aRequestandinithas no headers, seed withnew Headers(input.headers). - Relative URLs are never signed (
:87,:240,src/background.js:693).fetch('/profile/card')reaches the service worker unresolved,new URL()throws, the error is caught and no token is produced; the 401 retry fails the same way. Apps served from the pod itself get no NIP-98. A#fragmentis also passed into theutag. Fix:new URL(x, document.baseURI), clear the hash, send.href. - Every request on every site waits for the extension, and bodies are hashed before trust is known (
:98-116,:148,:179). Each fetch and XHR does a page → content script → service worker round trip, with a 2 s fallback if the worker is slow to wake. ABlobbody is read fully into memory and SHA-256 hashed first, on any site. Fix: ask "will you sign for this target?" first and hash only after a yes. - Method case (
:82,:88).{ method: 'get' }signs amethodtag ofgetwhile the wire method isGET; strict servers reject the token. Fix:.toUpperCase(). - XHR has no unsigned fallback for the Signed fetches to static hosts fail CORS preflight; retry unsigned on network error #33 case. A per-origin memo of hosts that failed preflight (follow-up 4 on Retry a signed GET/HEAD unsigned when it fails before a response (#33) #34) would cover both fetch and XHR.
Test gap behind several of these: the fake fetch in the sandbox tests reads init.headers only and never builds a real Request, so header replacement and Request-input behaviour are invisible to the suite.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
Page side: dynamic content scripts, state-driven bridge, interceptor …
jjohare commentedon Nov 28, 2026
Fixed in 0.0.13 (a2265b7): synchronous XHR passes straight through, the caller's options and headers are never written to, a
Requestkeeps its own headers, relative URLs are signed with the fragment left out, bodies are hashed only once the worker has decided to sign, and hosts that refuse signed requests are remembered for XHR as well as fetch. The method tag was fixed in 0.0.12. What is left is in #47.