-
Notifications
You must be signed in to change notification settings - Fork 0
Security hardening: forgeable sessions, free-tier login failure, and 9 other fixes #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
73dec9a
Fail closed when JWT_SECRET is missing or weak
Patel230 f1629db
Hash passwords with PBKDF2 via WebCrypto instead of bcryptjs
Patel230 55f9939
Revoke outstanding sessions when the password changes
Patel230 25e3e23
Close the login user-enumeration timing leak
Patel230 4c6b892
Rate limit the credential endpoints
Patel230 c207061
Reject and sanitize non-http(s) URLs
Patel230 5d9d5cf
Return 409 rather than 500 when registration races
Patel230 34c1469
Exclude archived jobs from every stat, not just the funnel
Patel230 216d7f3
Route the drawer's status change through /move
Patel230 9f1e987
Split the API into explicit public and protected routers
Patel230 de83d0c
Add security headers and self-host the font
Patel230 4631afb
Report the field that actually failed validation
Patel230 21961da
Build in CI
Patel230 d717cba
Update docs to match the security changes
Patel230 2e70622
Address review: orphan account on bad secret, weak stats test, /api h…
Patel230 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- Session JWTs were stateless, so changing your password rehashed the secret | ||
| -- but left every already-issued cookie valid for its full 30-day life. A | ||
| -- stolen session survived the exact action taken to revoke it. | ||
| -- | ||
| -- token_version is embedded in each JWT and compared on every authenticated | ||
| -- request. Bumping it invalidates all outstanding sessions for that user. | ||
| ALTER TABLE users ADD COLUMN token_version INTEGER NOT NULL DEFAULT 0; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /* | ||
| Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; form-action 'self'; base-uri 'none'; object-src 'none'; frame-ancestors 'none' | ||
| X-Content-Type-Options: nosniff | ||
| Referrer-Policy: strict-origin-when-cross-origin | ||
| X-Frame-Options: DENY | ||
| Strict-Transport-Security: max-age=31536000; includeSubDomains | ||
| Permissions-Policy: geolocation=(), microphone=(), camera=(), interest-cohort=() | ||
|
|
||
| # style-src needs 'unsafe-inline' because dnd-kit writes drag transforms to | ||
| # inline style attributes, which CSP treats as inline styles. script-src does | ||
| # NOT get it: that is the directive that matters here, and with it in place a | ||
| # stored javascript: URL has nothing to execute with. | ||
| # | ||
| # font-src 'self' is why the Space Grotesk woff2 is served from public/fonts | ||
| # rather than fonts.gstatic.com. | ||
Binary file not shown.
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
Apply these security headers to Worker-generated responses too.
public/_headersonly covers static asset responses;/api/*is handled by Worker code, so those responses won't inherit this CSP/header policy. Add the shared headers in the Worker response path as well, or document that this policy is static-assets only.🤖 Prompt for AI Agents