Skip to content

donee - #108

Open
A-Ramzy wants to merge 3 commits into
Advanced-Computer-Lab-2026:mainfrom
A-Ramzy:main
Open

donee#108
A-Ramzy wants to merge 3 commits into
Advanced-Computer-Lab-2026:mainfrom
A-Ramzy:main

Conversation

@A-Ramzy

@A-Ramzy A-Ramzy commented Nov 11, 2026

Copy link
Copy Markdown

No description provided.

A-Ramzy and others added 3 commits November 11, 2026 16:23
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant