Authentication¶
There is no password login for Signoff itself. Access is magic links + a short signed cookie.
Magic links¶
| Field | Behavior |
|---|---|
| Token | secrets.token_urlsafe(32) generated on create |
| Storage | SHA-256 hash of the token in magic_links.token |
| Expiry | 24 hours |
| Types | CREDENTIALS (enroll / update login), DELETION (remove account) |
| Use | Single use; used / used_at set on validate |
Create path: internal POST /api/magic-link (requires X-Internal-Secret).
Validate path: public GET /api/validate-magic-link?token=….
On success the API sets cookie credentials_auth and redirects toward /form (credentials) or /delete-account (deletion).
Cookie session¶
Implemented in src/auth/cookies.py with itsdangerous.URLSafeTimedSerializer.
| Setting | Value |
|---|---|
| Cookie name | credentials_auth |
| Lifetime | 30 minutes |
| Secret | COOKIE_SECRET_KEY |
| Payload | { email, expires_at } |
Cookie-protected routes include /form, /api/submit-credentials, /delete-account, and /api/confirm-delete-account.
Internal secret¶
Most other routes require header X-Internal-Secret matching INTERNAL_SECRET (middleware in src/endpoints/main.py). Public exceptions include magic-link validation, OpenAPI docs paths, and the cookie-protected routes above.
Warning
Default INTERNAL_SECRET falls back to change-me-in-production if unset. Production must set a strong value.
Rate limits¶
SlowAPI limits (per IP) include roughly:
- Magic link create: 20/hour
- Form access: 30/hour
- Credential submit: 5/hour
- Delete confirm: 5/hour