Stop allowing credentialed cross-origin requests (closes #261)
check / check (push) Failing after 5s

CORS() allowed every origin with credentials, so a page on another
origin of the same site could read what the signed-in user sees. It
now uses the options of the CONVENTIONS.md template: every origin as
*, no credentials, and the template's request headers. corsMaxAge
stays, since AGENTS.md asks for named constants.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-10 22:25:40 +00:00
1 parent f42c6214a0
commit 432342e963
3 files changed
+70 -15

No files matched your search

+8 -6
View File
@@ -168,8 +168,10 @@ either.
- Request bodies for `POST /api/v1/session`, `POST /api/v1/login` and
`POST /api/v1/messages` are limited to `MAX_MESSAGE_SIZE` bytes (default
`4096`). A larger body gets `400` `invalid request body`.
- The server allows cross-origin requests from any origin, with credentials. The
cookie is `SameSite=Strict`, so a browser sends it only from the same site.
- A response to a cross-origin request carries `Access-Control-Allow-Origin: *`,
never the request's origin, and never `Access-Control-Allow-Credentials`. A
page on another origin therefore cannot read the response to a request that
carries the cookie.
### The auth cookie
@@ -1896,10 +1898,10 @@ The IRC listener has no TLS.
carries a `Content-Security-Policy` header:
`default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self'; font-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'`.
The web client works within it.
- Cross-origin requests are allowed from any origin, with credentials. The
allowed methods are `GET`, `POST`, `PUT`, `DELETE` and `OPTIONS`. The allowed
request headers are `Accept`, `Content-Type` and `X-CSRF-Token`. The cookie's
`SameSite=Strict` still keeps it to the same site.
- A response to a cross-origin request carries `Access-Control-Allow-Origin: *`,
never the request's origin, and never `Access-Control-Allow-Credentials`. A
page on another origin therefore cannot read the response to a request that
carries the cookie.
### Logging