[test-improver] Add XSS bypass bug-pin tests for StringUtils.sanitize()#66
Draft
github-actions[bot] wants to merge 1 commit into
Draft
Conversation
8 new bug-pin tests documenting the known XSS bypass vectors in sanitize(). Each test asserts the current broken behaviour so future changes surface if a bypass is accidentally removed while others remain. Bypass vectors pinned: - <img src=x onerror=...> (event handler on img tag) - <svg onload=...> (event handler on svg tag) - <SCRIPT>...</SCRIPT> (all-uppercase not stripped) - <sCrIpT>...</sCrIpT> (mixed-case not stripped) - <script >...</script> (space before > on opening tag) - javascript: protocol in href/src - <body onload=...> (event handler on body) - <iframe src="javascript:..."> (iframe not stripped) No production code changed. No new dependencies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
14 tasks
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.
🤖 Test Improver — automated AI assistant focused on improving tests.
Goal & Rationale
StringUtils.sanitize()is documented as "NOT proper HTML sanitization" and is easily bypassed via well-known XSS vectors (Issue #8). This PR adds 8 bug-pin tests that document every known bypass so that:Bypass Vectors Documented
testSanitize_imgOnerrorBypass<img src=x onerror=alert(1)>testSanitize_svgOnloadBypass<svg onload=alert(1)>testSanitize_uppercaseScriptNotStripped<SCRIPT>...</SCRIPT>testSanitize_mixedCaseScriptNotStripped<sCrIpT>...</sCrIpT>testSanitize_scriptWithSpaceNotStripped<script >...</script>testSanitize_javascriptProtocolBypasstestSanitize_bodyOnloadBypass(body onload=...)testSanitize_iframeBypassNo Code Changes
No production code was modified. No new dependencies added.
Test Status
Pre-existing failures (not caused by this PR):
DateUtilsTest.testGetQuarter— off-by-one bug tracked in Issue 🔴 [BUG] getQuarter() returns 0-3 instead of 1-4 (off-by-one bug) #6TaskServiceTest.testGetTaskStatistics— division by zero tracked in Issue 🔴 [BUG] ArithmeticException: Division by zero on empty project dashboard #3Reproducibility
mvn test -B -Dtest=StringUtilsTestRelated
Add this agentic workflows to your repo
To install this agentic workflow, run