Fixed Raw Malicious Content Stored in Database#2713
Draft
Suresh-Krishna-P wants to merge 6 commits intoOWASP:masterfrom
Draft
Fixed Raw Malicious Content Stored in Database#2713Suresh-Krishna-P wants to merge 6 commits intoOWASP:masterfrom
Suresh-Krishna-P wants to merge 6 commits intoOWASP:masterfrom
Conversation
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.
Description
Problem Solved:
1. Player Model (
copi.owasp.org/lib/copi/cornucopia/player.ex)Added
validate_name/2function to changeset pipelineUpdated
valid_name?/1with the specified Unicode character set regex:~r/^[\u0600-\u06FF\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF\uFDF2\uFDF3\uFDF4\uFDFD\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FFF\uFF66-\uFF9Fー々〆〤\u3400-\u4DBF\uF900-\uFAFF\u0900-\u097F\u0621-\u064A\u0660-\u0669\u4E00-\u9FFF\u0E00-\u0E7F«»฿ฯ๏๚๛\u0400-\u04FF\u0500-\u052F\u2DE0-\u2DFF\uA640-\uA69FЮ́ю́Я́я́\u0370-\u03FF\u1F00-\u1FFFA-Za-zÀ-ÖØ-öø-ÿĀ-ž0-9._\--ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوي ﷲﷴﷺﷻ ٠١٢٣٤٥٦٧٨٩ \s]+$/Maintained existing sanitization functions for HTML tags, JavaScript, and data attributes
Added length validation (1-50 characters)
2. Game Model (
copi.owasp.org/lib/copi/cornucopia/game.ex)validate_name/2function to changeset pipelinevalid_name?/1with the same comprehensive Unicode character set3. Comprehensive Test Coverage (
copi.owasp.org/test/copi/cornucopia_test.exs)Added tests for XSS payload rejection in both Player and Game creation
Tests various attack vectors:
<script>alert('xss')</script>javascript:alert('xss')<img src=x onerror=alert('xss')>onload=alert('xss')<iframe src='javascript:alert(1)'></iframe>data:text/html,<script>alert('xss')</script>Validation Logic
The implementation uses a two-step validation approach:
This provides robust protection while maintaining full internationalization support for legitimate users worldwide.
Resolved or fixed issue: #2555
AI Tool Disclosure
[e.g. GitHub CoPilot, ChatGPT, JetBrains Junie etc.][e.g. GPT-4.1, Claude Haiku 4.5, Gemini 2.5 Pro etc.][Summarize the key prompts or instructions given to the AI tools]Affirmation