Autor SHA1 Nachricht Datum
sneak 0dd748ddf7 Refuse API writes that are not application/json (closes #271)
check / check (push) Failing after 3s
A page on another origin of the same site could send a text/plain or
form POST with the user's cookie, since a browser sends such a request
without a preflight. RequireJSON on the /api/v1 router answers 415 to a
POST, PUT or DELETE whose Content-Type is not application/json, or that
has none, before the handler runs.

The web client and neoirc-cli already send the header on every request.

Model: opus-5-5
2026-11-11 00:34:16 +00:00
+1 -2
Datei anzeigen
@@ -521,8 +521,7 @@ for every HTTP request when metrics are on.
Every other `GET` path serves the web client. A path that names one of its files
gets that file; any other path gets its `index.html`. An unknown path under
`/api/v1/` gets a plain-text `404`. A request whose method the path does not
take gets `405` with no body. Under `/api/v1/`, a `POST`, `PUT` or `DELETE`
without `Content-Type: application/json` gets `415` instead.
take gets `405` with no body.
### The message envelope