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_hardening_test.go +4−2

@@ -94,8 +94,10 @@ func TestAuthPagesAreNotCached(t *testing.T) {
94 94 if got := rw.Header().Get("Pragma"); got != "no-cache" {
95 95 t.Fatalf("%s: Pragma = %q, want no-cache", path, got)
96 96 }
97 if got := rw.Header().Get("Referrer-Policy"); got != "no-referrer" {
98 t.Fatalf("%s: Referrer-Policy = %q, want no-referrer", path, got)
97 // same-origin, not no-referrer: Firefox submits a form from a
98 // no-referrer page with Origin: null, which the origin lock refuses.
99 if got := rw.Header().Get("Referrer-Policy"); got != "same-origin" {
100 t.Fatalf("%s: Referrer-Policy = %q, want same-origin", path, got)
99 101 }
100 102 }
101 103 }