Repository navigation
Conversation
Protect the recovery-email update (and other writes) against CSRF using the csrf-csrf double-submit-cookie pattern: - server: new csrf middleware, GET /api/csrf-token endpoint, and doubleCsrfProtection on /items, /users, /settings; auth routes and safe GETs stay exempt. Forged writes with no token now return 403. - client: axios interceptor fetches and echoes the x-csrf-token header on every mutating request. - pin csrf-csrf@2.3.0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds the generated test harness so the suite runs on GitHub CI: - tests/server/csrf.test.js, tests/client/csrf.test.js - jest.config.cjs (server/node + client/jsdom projects), babel.config.cjs - .github/workflows/ci.yaml (npm install + npm test on push/PR) Generated from the project's .vscode setup scripts, excluding the dialog/prompt-injection side effects. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
csrf-csrf's generateToken is typed (res, req) — response first. The route passed (req, res), so the CSRF cookie was never set and every token failed validation, 403-ing the legitimate update. Swapping the args lets the happy-path write succeed while forged requests still 403. Co-Authored-By: Claude Opus 4.8 <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.
No description provided.