Fix Critical Security Issues: HTML Sanitization & Configuration Management
Description: While reviewing our codebase, I found several security concerns that need immediate attention:
Issues:
-
Unsafe HTML Content
NewsBar.jsx uses raw dangerouslySetInnerHTML without sanitization
- This leaves us vulnerable to XSS attacks
// Current risky code
<p dangerouslySetInnerHTML={{ __html: disclaimerText }}></p>
-
Google Analytics Implementation
- Analytics script is hardcoded in
Metadata.jsx
- No error handling or loading fallback
- Makes it hard to manage across environments
-
Hardcoded Configuration
- API endpoints and sensitive values are scattered throughout the code
- No proper environment variable management
Proposed Fix:
-
Add DOMPurify for HTML sanitization:
-
Move analytics to a dedicated service and add proper error handling
-
Set up environment configs:
.env.example
.env.development
.env.production
Todo:
Impact:
These changes will significantly improve our app's security and make it easier to maintain.
Fix Critical Security Issues: HTML Sanitization & Configuration Management
Description: While reviewing our codebase, I found several security concerns that need immediate attention:
Issues:
Unsafe HTML Content
NewsBar.jsxuses rawdangerouslySetInnerHTMLwithout sanitizationGoogle Analytics Implementation
Metadata.jsxHardcoded Configuration
Proposed Fix:
Add DOMPurify for HTML sanitization:
Move analytics to a dedicated service and add proper error handling
Set up environment configs:
Todo:
Impact:
These changes will significantly improve our app's security and make it easier to maintain.