Repository navigation
v0.2.0
Release v0.2.0 - The Hardening
crudauth shipped at v0.1.0 as a straight lift out of FastroAI: the whole auth surface,
extracted and packaged. v0.2.0 is the pass that turns "extracted" into "ready to depend on."
It works through a full security and correctness review of that code, restructures the
package so it's something you can read and extend, and adds the two capabilities the review
showed were missing.
crudauth is still pre-1.0 with no downstream users yet, so the fixes were made directly rather
than behind compatibility shims. Several are breaking and are listed at the end; read them
before upgrading from v0.1.0.
The security pass
The login path came first, since it's what an attacker reaches without authenticating. v0.2.0
closes the user-enumeration timing oracle, adds escalating per-IP and per-user lockout,
canonicalizes the lockout key, resolves the client IP behind a trusted-proxy boundary, and
SHA-256 pre-hashes passwords so bcrypt's 72-byte truncation can't make two long passwords
interchangeable.
Beyond login: OAuth state is bound to the initiating browser (closing a login-CSRF hole)
and the redirect is hardened against open redirects; bearer tokens gain revocation via a
token_version epoch that a password reset bumps; /register became a strict allowlist so a
new model column is never silently settable at signup; and one-time email tokens are consumed
atomically.
New capabilities
- Sudo mode (
sudo=SudoConfig()+auth.require_sudo()): short-lived re-authentication
for destructive actions, with its own lockout and anon_after_sudohook. POST /set-password: lets an OAuth-only account set a first password while authenticated.
Restructure
The package was reorganized into feature slices with a documented import-direction
architecture (crudauth/ARCHITECTURE.md), and the tests were split into source-mirroring
subpackages. Behavior-preserving; the suite stayed green throughout.
Breaking changes
/registeris a strict allowlist (opt columns in withregister_extra_fields).- Email endpoints renamed (
/email/verify-request,/password/reset-confirm, ...). token_versioncolumn added toAuthUserMixin(migration needed for revocation).check=now denies onFalseinstead of ignoring it.- Disabled accounts return the generic credentials error.
- Bearer scopes are clamped to a grantable ceiling.
- Storage / rate-limiter ports gained required methods (BYO backends must implement them).
- Removed
OAuthToken,SessionData.is_active, and the single-argget_client_ip(request).