Skip to content

fix(xss): sanitize review HTML with DOMPurify and add CSP via helmet - #86

Open
kareemroshdy2004-cpu wants to merge 1 commit into
Advanced-Computer-Lab-2026:masterfrom
kareemroshdy2004-cpu:master
Open

kareemroshdy2004-cpu wants to merge 1 commit into
Advanced-Computer-Lab-2026:masterfrom
kareemroshdy2004-cpu:master

Conversation

@kareemroshdy2004-cpu

Copy link
Copy Markdown

Close the stored-XSS path in the Reviews feature with defense-in-depth:

  • client: sanitizeHtml now runs review bodies through DOMPurify (allow-list of light formatting tags; strips <script>, inline event handlers, and javascript: URLs) before dangerouslySetInnerHTML.
  • server: add helmet with a custom Content-Security-Policy (script-src 'self', no 'unsafe-inline') so the browser refuses injected inline scripts.

Also add the jest test scaffolding and CI workflow.

Close the stored-XSS path in the Reviews feature with defense-in-depth:
- client: sanitizeHtml now runs review bodies through DOMPurify (allow-list
  of light formatting tags; strips <script>, inline event handlers, and
  javascript: URLs) before dangerouslySetInnerHTML.
- server: add helmet with a custom Content-Security-Policy (script-src 'self',
  no 'unsafe-inline') so the browser refuses injected inline scripts.

Also add the jest test scaffolding and CI workflow.

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