Skip to content

fix(security): patch DOM-based XSS vulnerabilities across UI#947

Merged
steam-bell-92 merged 2 commits into
steam-bell-92:mainfrom
Shashank-8p:fix/cross-site-scripting
Jun 3, 2026
Merged

fix(security): patch DOM-based XSS vulnerabilities across UI#947
steam-bell-92 merged 2 commits into
steam-bell-92:mainfrom
Shashank-8p:fix/cross-site-scripting

Conversation

@Shashank-8p
Copy link
Copy Markdown
Contributor

📝 Description

Resolves critical DOM-based Cross-Site Scripting (XSS) vulnerabilities found across the application's calculators and modal architecture.

Architectural Changes Implemented:

  • Native DOM Escaping: Migrated unsafe .innerHTML injections in calculators (Armstrong, FLAMES) to use document.createElement() and .textContent, forcing the browser to treat malicious payloads as harmless strings.
  • Sanitization Integration: Added the DOMPurify library via CDN to strictly sanitize complex HTML payloads before they are injected into the dynamic project modal.
  • UI Hardening: Refactored dynamic list generation in main.js to build DOM nodes in memory rather than concatenating raw HTML strings.

🔗 Linked Issue

Closes #809


📋 Contribution Checklist

  • My code strictly adheres to the project guidelines.
  • I have tested my changes locally using standard XSS payloads (<img src=x onerror=alert(1)>).
  • I have verified that safe HTML rendering (like the modal) still works correctly after sanitization.
  • GSSoC 2026: I have been formally assigned to this issue and noted it above.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@Shashank-8p is attempting to deploy a commit to the Anuj's projects Team on Vercel.

A member of the Team first needs to authorize it.

@steam-bell-92 steam-bell-92 merged commit 7d3fad5 into steam-bell-92:main Jun 3, 2026
7 of 8 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

🎉 Thank you for your contribution!

Your Pull Request has been merged successfully.

We appreciate the time and effort you put into improving this project. Contributions like yours help the repository grow and stay useful for everyone.

If you'd like to contribute again, please check the open issues and make sure you are assigned before opening another Pull Request.

Thanks again for your support! 🙌

@Shashank-8p Shashank-8p deleted the fix/cross-site-scripting branch June 3, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: DOM-Based Cross-Site Scripting (XSS) vulnerability via innerHTML

2 participants