Fix Stored XSS in User Profile - first_name Field#360
Open
grich88 wants to merge 1 commit intoAIxBlock-2023:mainfrom
Open
Fix Stored XSS in User Profile - first_name Field#360grich88 wants to merge 1 commit intoAIxBlock-2023:mainfrom
grich88 wants to merge 1 commit intoAIxBlock-2023:mainfrom
Conversation
Author
|
This PR fixes Issue #357 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #2: Fix Stored XSS in User Profile - first_name Field
Fixes #357
🔧 FIX: STORED XSS VULNERABILITY
Related Issue: #357 (Stored XSS in User Profile)
Severity: High (CVSS 8.8)
Files Changed:
📋 SUMMARY
This PR fixes a stored XSS vulnerability in the
first_namefield that allowed persistent JavaScript injection, enabling session hijacking and account takeover.Vulnerability: No input sanitization on
first_namefieldFix: Add input sanitization and output encoding
🔍 CHANGES
Backend Fix (Input Sanitization)
Location: User profile update handler (Django/TypeScript)
Before (Vulnerable):
After (Fixed):
TypeScript/Node.js Example:
Frontend Fix (Output Encoding)
Location: User profile display components
Before (Vulnerable):
After (Fixed):
React Example:
✅ WHAT THIS FIX DOES
🧪 TESTING
Test 1: XSS Payload (Should Be Sanitized)
Expected:
<img src=x onerror=alert(1)>img src=x onerror=alert(1)(tags stripped)<img src=x onerror=alert(1)>(HTML encoded)Test 2: Legitimate Data (Should Work)
Expected:
John O'BrienJohn O'BrienJohn O'Brien(properly escaped)Test 3: Special Characters (Should Work)
Expected:
José & MaríaJosé & MaríaJosé & María(HTML encoded)🔐 SECURITY IMPACT
📝 ADDITIONAL RECOMMENDATIONS
last_name,username, etc.✅ VERIFICATION CHECKLIST
Status: Ready for Review
Date: 2025-11-11