mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-05 08:15:41 -08:00
Sign the macOS app's dashboard frame in by a path prefix, since WebKit gives it no cookie
AI Assisted
This commit is contained in:
1 parent
1d007737b1
commit
98bdbc97c3
10 files changed
+411
-21
No files matched your search
@@ -161,7 +161,7 @@ Security, six controls, about 60 lines:
|
||||
1. Bind `127.0.0.1`.
|
||||
2. **`Host` header allowlist.** This is the DNS-rebinding defense and the highest-value line in the server. Vite shipped GHSA-vg6x-rcgg-rjx6 for exactly this omission.
|
||||
3. 128-bit token **in the URL path**, not the query string. Path placement also kills the Windows `cmd /c start` `&`-injection hazard, because the URL then contains no `&`.
|
||||
4. First `GET /s/<token>/` sets `HttpOnly; SameSite=Strict` cookie and 302s to `/`. Token leaves the address bar, history and pasted screenshots; CSRF protection comes free.
|
||||
4. First `GET /s/<token>/` sets `HttpOnly; SameSite=Strict` cookie and 302s to `/`. Token leaves the address bar, history and pasted screenshots; CSRF protection comes free. The macOS desktop app's frame is the exception: WebKit gives a cross-site frame no cookie, so there the 302 goes to `/f/<sha256(token)[0:32]>/` on the same `127.0.0.1` address, the router takes that exact prefix off the raw request line once, and a request under it passes the token gate. The page uses only page-relative URLs, so it works at `/` and under the prefix alike. Not a `<key>.localhost` host name: macOS tries it on `[::1]` first, where another process can take the port.
|
||||
5. `Origin` check on every mutating request.
|
||||
6. Strict CSP with no `unsafe-inline`, which is why JS and CSS are separate files rather than one inlined HTML.
|
||||
|
||||
|
||||
@@ -133,6 +133,11 @@ this:
|
||||
visiting from talking to it through a DNS rebinding trick.
|
||||
- A 128-bit token in the link, swapped for an `HttpOnly; SameSite=Strict` cookie
|
||||
on first load so it leaves your address bar, your history and any screenshot.
|
||||
In the macOS desktop app the page's frame gets no cookie (WebKit blocks
|
||||
cookies for a frame from another site), so the link sends that frame to
|
||||
`/f/<key>/` on the same `127.0.0.1` address instead, where the key is a hash
|
||||
of the token, and the server lets in only requests under that exact prefix.
|
||||
The frame has no address bar, and a browser tab still gets the cookie.
|
||||
- A strict Content Security Policy with no inline script allowed.
|
||||
- Markdown written by the agent is turned into page elements directly and never
|
||||
into an HTML string, so a document that quotes a hostile README cannot run
|
||||
|
||||
Reference in new issue
Block a user