Refuse a query string on every route
Breaking: every route now answers a request with a query string with 400 invalid_query, where all but the module routes used to ignore it. A caller must drop the query string and send any input in the JSON body. No route takes an input from the query any more, now that the module routes take copies and printer in the JSON body. The other routes ignored a query, so a caller that sent one had it dropped without a word: an old module caller's ?copies=2 on another route, or a typo. The refusal's message is "query parameters are not accepted". The check runs after routing and, under /api/v1, after the token, the rate limit and the token's scope, so an unknown route still answers 404 and a token sent only in the query still 401. A bare question mark is no query. The OpenAPI document lists invalid_query on every route, and a route's parameters can no longer be in the query. Nothing that ships with the daemon sends it a query: the install, the Docker image and the ntfy recipes post bodies or read /healthz plainly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9e829bfce7
commit
6bfaee0bc8
8 files changed
+212
-33
No files matched your search
+5
-2
@@ -195,6 +195,9 @@ upgrade a 0.1 install.
|
||||
- Bearer tokens are read only from the `Authorization` header. A token in a
|
||||
`?token=` query string gets `401`. 0.1 tokens keep working in the header
|
||||
while `api.secret` is unchanged.
|
||||
- No route takes a query string, since every input goes in the JSON body:
|
||||
a request with one gets `400` `invalid_query`, after the token check on
|
||||
the `/api/v1` routes.
|
||||
- `install.sh` sets up Caddy instead of nginx and acme.sh, on a fresh host. It
|
||||
does not upgrade a host set up by the 0.1 script. See README § Quick start.
|
||||
- `printer.address` is required. The 0.1 install script did not write it, so
|
||||
@@ -330,8 +333,8 @@ upgrade a 0.1 install.
|
||||
`{"title", "text", "items", "done"}`, with `style`, `footer` and `stamp`
|
||||
as options. `docs/api.md` § Modules describes it.
|
||||
- The module routes answer with the error codes `invalid_payload` (400),
|
||||
`invalid_query` (400) for a query string, `unknown_printer` (400),
|
||||
`module_not_found` (404) and `module_failed` (422).
|
||||
`unknown_printer` (400), `module_not_found` (404) and `module_failed`
|
||||
(422).
|
||||
- `[format]` with `max_lines` (default 2000): a job that would print more
|
||||
lines fails instead of printing. `/api/v1/preview` answers such a job with
|
||||
`422` and the code `too_many_lines`.
|
||||
|
||||
Reference in new issue
Block a user