Repository navigation
fix(security): harden headers, logins, sessions and logs before launch - #11
Merged
Merged
Conversation
- CSP (self only, plus http.cat for the 404 cat; no framing), Referrer-Policy same-origin, HSTS when served over https, on every response. - Login rate limit counts per email AND IP, so strangers can't lock an owner out; the per-IP limit stays. - A password change (aot user reset-password) logs out every existing session of that user (migration 0002: users.sessions_revoked_at). - OAuth logins no longer log the account name (a Microsoft UPN is an email) or the provider's profile JSON. - Two simultaneous signups with one email: the loser sees "already exists" instead of a 500. Co-Authored-By: lazytrek <352825308+lazytrek@users.noreply.github.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.
Fixes 1–5 from the pre-launch security review.
Content-Security-Policy: default-src 'self'; img-src 'self' https://http.cat; style-src 'self' 'unsafe-inline'; frame-ancestors 'none'; base-uri 'none'; form-action 'self''unsafe-inline'for styles is there because templates usestyle=attributes.Referrer-Policy: same-originStrict-Transport-Security: max-age=31536000, only whenAOT_BASE_URLis https.nosniffmoves into the same middleware.aot user reset-password(viadb::set_password_hash) setsusers.sessions_revoked_at. Sessions that logged in before that time are dropped on their next request. Migration0002_sessions_revoked_at.sqladds the column.Not changed: the http.cat 404 picture (kept on purpose), POSTs without an
Originheader (every current browser sends one), container hardening.Check
cargo audit: no vulnerabilities, two "unmaintained" warnings (basic-toml,chrono) with no fix available.Pre-launch, so no version bump.
Co-Authored-By: lazytrek 352825308+lazytrek@users.noreply.github.com