Add input validation and sanitization to prevent stored XSS (Issue #276)#318
Add input validation and sanitization to prevent stored XSS (Issue #276)#318anshul23102 wants to merge 2 commits into
Conversation
Creates comprehensive input validation module to sanitize GitHub user data before storing in Firestore. Validates and sanitizes: - GitHub usernames against official GitHub format rules - Email addresses with proper format validation - Display names with XSS pattern detection - Avatar URLs with domain whitelisting Prevents stored XSS by: - Detecting and removing dangerous HTML/JS patterns - Limiting string lengths - Validating URL formats - Sanitizing all user inputs before storage Integrates validation into login flow with clear error reporting. Fixes issue indresh404#276
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Please add relevant labels:
These help with tracking and prioritization. Thank you! |
Suggested LabelsFor maintainer review and categorization:
Implements comprehensive input validation and sanitization to prevent stored XSS vulnerabilities. |
|
fix conflict |
…store optimization Merge conflict in src/context/AuthContext.jsx resolved by: - Keeping both import statements for validation and optimization utilities - Maintaining input validation and sanitization for XSS prevention - Preserving firestore optimization imports for performance This ensures secure user data handling while maintaining optimized firestore queries. All user inputs are validated and sanitized before storage. Related: indresh404#276, indresh404#318
|
Hi @indresh404, I've resolved the merge conflict in this PR. The conflict in Resolution Strategy:
Key Security Improvements Maintained:
Branch Status:
The implementation now provides both security hardening AND performance optimization, ensuring the application is both fast and secure. Closes #276 |
|
If your PR still shows the old failed Vercel check, please rebase (or merge the latest main branch into your branch) and push again to trigger a fresh deployment/check run. |
Summary
Implements comprehensive input validation and sanitization for GitHub user data before storage in Firestore. Prevents stored XSS attacks and data corruption vulnerabilities.
Problem
GitHub user data (username, display name, email, avatar URL) is stored in Firestore without validation or sanitization, enabling:
Solution
Created
src/utils/inputValidation.jswith:Security Features:
Changes
src/utils/inputValidation.jswith validation functionssrc/context/AuthContext.jsxto validate user data before Firestore storageValidation Rules
GitHub Username:
^[a-zA-Z0-9]([a-zA-Z0-9-]{0,37}[a-zA-Z0-9])?$Email (optional):
Display Name (optional):
Avatar URL (optional):
Testing Strategy
Files Modified
Fixes #276