Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Keep no-store pages same-origin for Firefox forms

c4e9d9571b41c4d47a6467987fea4f522e6e98d5 · Keenan Nemetz · 8d ago · parent 6c694920

Keep no-store pages same-origin for Firefox forms

Firefox sends Origin: null for a form post from a document with
Referrer-Policy: no-referrer, even when the page and action are same-origin.
sameOriginRequest deliberately refuses the opaque origin, so every form on the
account, sign-in, registration, and invitation pages returned 403 before its
handler ran. Adding an SSH key from Firefox failed even with a correct CSRF
field and a freshly loaded canonical page.

noStore now keeps the referrer same-origin. That still sends no referrer to
another site, while Firefox sends the real Origin and the existing lock accepts
it. The opaque origin remains refused: this fixes the page rather than weakening
the check.

Also name the two CSRF refusal reasons so a stale form or a foreign origin is
not left as a bare bad request.

closes: 01M8AN4K0NWPEQ5CKQ934M5FV5

server/web/auth_handlers.go +2−2

@@ -472,8 +472,8 @@ func (w *Web) Logout(rw http.ResponseWriter, r *http.Request) {
472 472 http.Error(rw, "cannot read the form", http.StatusBadRequest)
473 473 return
474 474 }
475 if !w.csrfOK(r) {
476 http.Error(rw, "bad request", http.StatusForbidden)
475 if problem := w.csrfProblem(r); problem != "" {
476 http.Error(rw, problem, http.StatusForbidden)
477 477 return
478 478 }
479 479 }