Name the cause on the page for a refused form (closes #358)
check / check (push) Canceled after 0s

The CSRF middleware answered a refused login or generator form with the
library's bare text, such as "Forbidden - origin invalid". It now answers
403 with a page that names the cause and what to do, and logs a warning
with the request ID and the library's reason. A page opened over plain
HTTP with debug off and a form from another host both fail the origin
check; the page tells them apart by the host in the Origin or Referer
header.

Model: opus-5-5
This commit was merged in pull request #365.
This commit is contained in:
clawbot committed 2026-11-11 22:55:39 +01:00
1 parent 9bccaaf85a
commit b32077c380
7 files changed
+343 -6

No files matched your search

+4
View File
@@ -403,6 +403,10 @@ instead. Plain HTTP is for development on the browser's own machine. The login
session cookie is always marked `Secure`. Over plain HTTP a browser keeps such a
cookie only for its own machine (`localhost`), if at all.
A form refused with 403 gets a page that names the cause and what to do about
it. pixa logs a `form refused` warning with the request ID and the form-token
library's reason, such as `origin invalid`.
The image routes answer the errors listed for them with a JSON body holding
`error`, `status` and `timestamp`.