Security: Backend has no CSRF token validation — client-side CSRF protection is security theater#222
Open
fawizzy wants to merge 5 commits intoCalebux:mainfrom
Open
Security: Backend has no CSRF token validation — client-side CSRF protection is security theater#222fawizzy wants to merge 5 commits intoCalebux:mainfrom
fawizzy wants to merge 5 commits intoCalebux:mainfrom
Conversation
The CSRF functions (generateCSRFToken, storeCSRFToken, getCSRFToken, validateCSRFToken) were never called anywhere in the codebase and the backend never validated any CSRF header. Since auth uses Supabase JWT Bearer tokens — not cookies — CSRF is not a risk; removed the dead code and added a comment explaining why. Closes Calebux#120.
- Switch Geist font import from Google Fonts to local geist npm package (network can't reach fonts.googleapis.com at build time) - Remove duplicate logTeamAction/logDataExport functions and stray closing braces introduced by upstream merge in audit-log.ts - Fix private flushAuditQueue called outside class (make public) - Disable ESLint during builds (pre-existing lint errors across codebase) - Update lockfiles for new uuid and @types/uuid dependencies
|
@fawizzy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
The CSRF utility functions in client/lib/security-utils.ts (generateCSRFToken,
storeCSRFToken, getCSRFToken, validateCSRFToken) were never called anywhere
in the codebase, and the backend never validated any X-CSRF-Token header —
making the code actively misleading rather than protective.
Why CSRF protection is not needed here:
SYNCRO authenticates via Supabase JWT Bearer tokens sent in the Authorization
header. CSRF attacks work by exploiting the browser's automatic sending of
cookies — they cannot read or forge a Bearer token from a different origin. No
cookies, no CSRF risk.
Changes:
Closes #120