Take auth/ whole from boilerplate 09e144d: the lockout claimed before the scrypt, APP_PASSWORD recovery closing every session, Starlette's cookie parser, the rightmost forwarded hop in the log, revoke_all on a password change, a 421 for a non-loopback Host on an open app, API tokens in auth_tokens behind Authorization: Bearer, and sockets closed with their credential
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
83e965dfeb
commit
244e57ac29
19 files changed
+2288
-214
No files matched your search
+8
-8
@@ -22,7 +22,7 @@ from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class AuthConfig(BaseModel):
|
||||
"""The `auth:` block of `config.yaml`. See docs/password-protection.md."""
|
||||
"""The `auth:` block of `config.yaml`. See documentation/Password Protection.md."""
|
||||
|
||||
#: Unknown keys are refused rather than ignored, the same rule the app's
|
||||
#: own sections keep: a setting you believe you have changed and have not
|
||||
@@ -38,9 +38,9 @@ class AuthConfig(BaseModel):
|
||||
#: Deciding from the bind address rather than defaulting to off is the
|
||||
#: whole point. The failure this prevents is the one that actually happens:
|
||||
#: you deploy, it works, and nothing anywhere tells you the door is open.
|
||||
#: `always` locks it on localhost too and is what a deployment behind a
|
||||
#: TLS-terminating proxy needs, since there every request looks local to
|
||||
#: the app and is not. `never` is for putting some other authentication in
|
||||
#: `always` locks it on localhost too and is what a deployment sets, so the
|
||||
#: lock does not depend on the bind address or on how the process was
|
||||
#: started. `never` is for putting some other authentication in
|
||||
#: front of this one, and means exactly what it says.
|
||||
enabled: Literal["auto", "always", "never"] = "auto"
|
||||
|
||||
@@ -52,10 +52,10 @@ class AuthConfig(BaseModel):
|
||||
|
||||
#: Whether the session cookie is marked `Secure`, so a browser will only
|
||||
#: ever send it back over HTTPS. `auto` sets it when the request itself
|
||||
#: arrived over HTTPS, which is right when the app terminates TLS and wrong
|
||||
#: behind a reverse proxy that terminates it for you -- there the app sees
|
||||
#: plain HTTP and `auto` reads as "no". Set `always` when something else is
|
||||
#: doing TLS. `never` exists for testing over http on a LAN and is the
|
||||
#: arrived over HTTPS, which behind a reverse proxy that terminates TLS
|
||||
#: holds only while the server trusts `X-Forwarded-Proto` from it; the app
|
||||
#: alone cannot tell. Set `always` when something else is doing TLS.
|
||||
#: `never` exists for testing over http on a LAN and is the
|
||||
#: setting to be uncomfortable with.
|
||||
secure_cookie: Literal["auto", "always", "never"] = "auto"
|
||||
|
||||
|
||||
Reference in new issue
Block a user