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
+6
-4
@@ -506,10 +506,12 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
|
||||
the request's JSON body, never in a query parameter. The path holds only
|
||||
a resource's ID, or a fixed word that names the route, as `last`,
|
||||
`failed` and `uncertain` do in `/jobs/.../reprint`. A `GET` takes no
|
||||
inputs beyond its path. The module routes follow it: their body holds
|
||||
the module's payload, `copies` and `printer`, and a query string gets
|
||||
`400` `invalid_query`. Some of the plans break the rule today, and a
|
||||
later change makes them follow:
|
||||
inputs beyond its path. Every route answers a query string with `400`
|
||||
`invalid_query`, after the token and its scope under `/api/v1`, so a
|
||||
caller that still sends one learns so instead of having it ignored. The
|
||||
module routes' body holds the module's payload, `copies` and `printer`.
|
||||
Some of the plans break the rule today, and a later change makes them
|
||||
follow:
|
||||
- the `?printer=` that docs/plans/printers.md puts on `/print`,
|
||||
`/preview` and the module routes;
|
||||
- the filters and paging that docs/plans/job-store.md's phase 2 puts in
|
||||
|
||||
Reference in new issue
Block a user