Reports are taken only as application/json (closes #126)
check / check (push) Waiting to run
check / check (push) Waiting to run
A page on another origin can POST text/plain or a form without a CORS preflight, so its visitors' browsers could store reports although the server sends no CORS headers. decodeJSON now refuses a request whose Content-Type is not application/json (parameters such as charset allowed), and the report handler answers it 415 with the usual error body, storing nothing. A JSON POST waits for the preflight, which only an origin in CORS_ALLOWED_ORIGINS passes; the page already sends application/json. Model: opus-5-5
This commit was merged in pull request #132.
This commit is contained in:
@@ -21,6 +21,17 @@ Run `make frontend-viewport-test` in CI as its own step; it is not part of
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-10-14: `POST /api/v1/reports` takes only a report sent with
|
||||
`Content-Type: application/json`, parameters such as `charset` allowed, and
|
||||
refuses any other with 415 and the usual error body, storing nothing
|
||||
([#126](https://git.eeqj.de/sneak/netwatch/issues/126)). A page on another
|
||||
origin can send a `text/plain` POST without a CORS preflight, so any site
|
||||
could make its visitors' browsers store reports; a JSON POST waits for the
|
||||
preflight, which only an origin in `CORS_ALLOWED_ORIGINS` passes. The page
|
||||
already sent `application/json`. A test posts a report as `text/plain`, as
|
||||
`application/x-www-form-urlencoded`, as `multipart/form-data`, with no
|
||||
`Content-Type`, and as `application/json` with and without a charset, and
|
||||
checks which are stored
|
||||
- 2026-10-14: changing the interval no longer drops the samples not yet reported
|
||||
to the backend ([#124](https://git.eeqj.de/sneak/netwatch/issues/124)). The
|
||||
interval menu resets each host with the new `HostState.reset`, which moves the
|
||||
|
||||
Reference in New Issue
Block a user