Repository navigation
Add optional password login (MAILGREP_PASSWORD) - #3
Merged
Merged
Conversation
A single shared password gates every /api route except login, logout and auth status. Sessions are stateless HMAC-signed HttpOnly SameSite=Strict cookies (30 days), keyed on the password and MAILGREP_KEY, so changing either signs everyone out. Failed attempts are serialised and delayed. Unset keeps today's behaviour, with a startup warning. The SPA shows a sign-in screen whenever /api/auth or any request returns 401, and settings gets a sign-out button. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional single shared password.
MAILGREP_PASSWORDset → every/api/*route except/api/auth,/api/login,/api/logoutreturns 401 without a valid session. Unset → unchanged behaviour plus a startup warning.<expiry>.<hmac>cookie (HttpOnly,SameSite=Strict,Securebehind an HTTPS proxy), 30 days, HMAC key derived from the password +MAILGREP_KEY, so rotating either signs everyone out. No session storage./api/authsays so or any query/mutation gets a 401; sign-out button in settings. The sandboxed message iframe (allow-same-origin) keeps the cookie, so inline images and attachments still work.Tested:
cargo test(new unit + HTTP-level login test),npm run build(incl.tsc), and a headless-Chromium run of wrong password → sign in → reload → sign out against the real binary.🤖 Generated with Claude Code