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
+9
-1
@@ -291,11 +291,19 @@ def login_verify(config: AuthConfig, request: Request, store: AuthStore,
|
||||
)
|
||||
|
||||
challenge = _challenge_from(credential)
|
||||
# Read before the challenge is spent, and inside a `try`: outside one, a
|
||||
# `rawId` that is not base64url was a 500 from an endpoint anyone can
|
||||
# reach, after the challenge had already been used up.
|
||||
try:
|
||||
raw_id = base64url_to_bytes(credential.get("rawId", ""))
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise PasskeyMalformed("That response was not a passkey: its rawId is "
|
||||
"not base64url.") from exc
|
||||
if not store.take_challenge(challenge, "login"):
|
||||
raise PasskeyError("That sign-in took too long, or was already used. "
|
||||
"Try again.")
|
||||
|
||||
known = store.passkey_for(base64url_to_bytes(credential.get("rawId", "")))
|
||||
known = store.passkey_for(raw_id)
|
||||
if known is None:
|
||||
# Deliberately the same sentence as a bad signature. There is one user,
|
||||
# so this leaks little, but "that key is not registered" is an oracle
|
||||
|
||||
Reference in new issue
Block a user