mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-05 16:15:41 -08:00
Trim comments and docs to what the code needs
AI Assisted
This commit is contained in:
1 parent
eba3c3bf0c
commit
0bd721fc27
33 files changed
+292
-392
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. 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.
|
||||
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. A path, not a `<key>.localhost` host name: macOS tries that 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.
|
||||
|
||||
|
||||
@@ -136,8 +136,8 @@ this:
|
||||
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.
|
||||
of the token, and a request under that exact prefix is signed in. 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