diff --git a/src/test/java/com/taskflow/util/StringUtilsTest.java b/src/test/java/com/taskflow/util/StringUtilsTest.java index 32788ba..f73204e 100644 --- a/src/test/java/com/taskflow/util/StringUtilsTest.java +++ b/src/test/java/com/taskflow/util/StringUtilsTest.java @@ -91,4 +91,78 @@ public void testJoin() { } // No test for padRight - it has a known StringIndexOutOfBoundsException bug + + // ------------------------------------------------------------------------- + // BUG-PIN TESTS: sanitize() XSS bypass vectors (Issue #8) + // + // These tests document the *current broken behaviour* so that future changes + // will surface if any bypass is accidentally "fixed" while others remain, + // and so that a real fix must change ALL of them to assert the cleaned output. + // + // The sanitize() method only strips literal "" (plus the + // Title-case variants). Every other XSS vector passes through unchanged. + // ------------------------------------------------------------------------- + + @Test + public void testSanitize_imgOnerrorBypass() { + // BUG-PIN (Issue #8): is not removed — XSS bypass + String payload = ""; + assertEquals(payload, StringUtils.sanitize(payload), + "BUG: must be stripped but currently passes through unchanged"); + } + + @Test + public void testSanitize_svgOnloadBypass() { + // BUG-PIN (Issue #8): is not removed — XSS bypass + String payload = ""; + assertEquals(payload, StringUtils.sanitize(payload), + "BUG: must be stripped but currently passes through unchanged"); + } + + @Test + public void testSanitize_uppercaseScriptNotStripped() { + // BUG-PIN (Issue #8): event handler is not removed — XSS bypass + String payload = ""; + assertEquals(payload, StringUtils.sanitize(payload), + "BUG: must be stripped but currently passes through unchanged"); + } + + @Test + public void testSanitize_iframeBypass() { + // BUG-PIN (Issue #8): "; + assertEquals(payload, StringUtils.sanitize(payload), + "BUG: