diff --git a/reader/chat.html b/reader/chat.html index 615c53a..e1fe556 100644 --- a/reader/chat.html +++ b/reader/chat.html @@ -12,7 +12,11 @@ rides in the document. `script-src 'self'` is the point of it: every library this page uses is in shared/, so nothing may be fetched from a CDN even if a tag for one reappears. `connect-src https:` stays open - because reading atproto means talking to whichever PDS hosts the author. --> + because reading atproto means talking to whichever PDS hosts the author. + `form-action 'none'` is safe *here* and is not on the chat side: this page + has no forms. The chat's login is a form that redirects to whichever PDS + hosts the handle, and Chrome and WebKit apply form-action to the redirect + target — which silently cancelled every login. Do not copy this line over. --> diff --git a/reader/index.html b/reader/index.html index f45b32c..adfb481 100644 --- a/reader/index.html +++ b/reader/index.html @@ -11,7 +11,11 @@ rides in the document. `script-src 'self'` is the point of it: every library this page uses is in shared/, so nothing may be fetched from a CDN even if a tag for one reappears. `connect-src https:` stays open - because reading atproto means talking to whichever PDS hosts the author. --> + because reading atproto means talking to whichever PDS hosts the author. + `form-action 'none'` is safe *here* and is not on the chat side: this page + has no forms. The chat's login is a form that redirects to whichever PDS + hosts the handle, and Chrome and WebKit apply form-action to the redirect + target — which silently cancelled every login. Do not copy this line over. --> diff --git a/server/proxy.py b/server/proxy.py index 9cfe7fe..f5fb001 100644 --- a/server/proxy.py +++ b/server/proxy.py @@ -117,6 +117,23 @@ GLOBAL_EVENTS = {"server.connected"} # `'unsafe-inline'` is there because the whole application is one inline script # and one inline style; it is not what this policy is for. `connect-src 'self'` # is: an injected script still could not send anything off this origin. +# **No `form-action`, deliberately.** It was here for one afternoon and it +# broke every login on the service, including for people already signed in the +# moment they signed out. +# +# Logging in is a form that submits to `/login`, which answers 302 to the +# authorize URL on whichever PDS hosts that handle. Chrome and WebKit enforce +# `form-action` against the *redirect target* of a submission, not just its +# immediate action — so `'self'` cancelled the navigation to the PDS silently. +# No error, no console message the user would find, no request reaching +# anything: the browser simply stayed put, which reads exactly like "the login +# page bounced me back". Firefox does not do this, so it depends on the +# browser too. +# +# It cannot be fixed by listing hosts, because the whole point of atproto is +# that the PDS is wherever that person keeps their repo. `form-action` does not +# fall back to `default-src`, so leaving it out is not a hole in the rest of +# this policy — it restores the default of not restricting where forms go. CSP = ("default-src 'none'; " "script-src 'self' 'unsafe-inline'; " "style-src 'self' 'unsafe-inline'; " @@ -124,7 +141,6 @@ CSP = ("default-src 'none'; " "connect-src 'self' https://public.api.bsky.app https://plc.directory; " "font-src 'self'; " "base-uri 'none'; " - "form-action 'self'; " "frame-ancestors 'none'") CONTENT_TYPES = {