-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Issue Description
Multiple instances of dynamic content are being inserted via innerHTML without proper sanitization. This creates potential XSS vulnerabilities if article data or error messages contain malicious scripts.
Risk Level
HIGH/CRITICAL
Affected Files
src/scripts/index.js
Details
Problem Locations
-
Line 66: Error message display with user-controlled content
document.getElementById("articleBody").innerHTML = ArticleFiller.article;
-
Line 263: Article markdown conversion output
document.getElementById("articleBody").innerHTML = ArticleFiller.article;
-
Lines 370, 398, 400, 420, 450, 470, 537: Archive and carousel display with dynamic content
Example Vulnerability
If an article title contains <script>alert('xss')</script>, it would execute directly in the browser.
Expected Behavior
All dynamic content should be properly escaped or sanitized before being inserted into the DOM.
Solution Approach
- Create a sanitization utility function to escape HTML entities
- Replace all
innerHTMLassignments withtextContentor escaped HTML content - Consider using a library like DOMPurify for complex HTML cases
- Add unit tests to verify sanitization
Labels
security, bug, critical
Reactions are currently unavailable