Repository navigation
ig_detect_xss with a script URL check (TASKS 1.2) - #19
Merged
Merged
Conversation
…TASKS 1.2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libinjection_xss covers injection into HTML; a value that is a script URL (javascript:, vbscript:, HTML/SVG data:) is checked by us. The fingerprint says which one fired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
ig_detect_xss(s, len, res): same contract asig_detect_sqli. The fingerprint says what fired:html(libinjection_xss) orurl(our check).javascript:alert(1)): the whole value is a script URL — leading C0 controls/spaces skipped, tab/LF/CR inside the scheme ignored (WHATWG), case-insensitive;javascript:/vbscript:only with a code character(,`or=after it (so "JavaScript: The Good Parts" stays clean);data:withtext/html,image/svg+xml,application/xhtml+xml.ERROR; otherwiseERRORstays an error.fuzz_detect_xsswith seeds.Verified locally: unit (gcc, clang + ASan/UBSan, CentOS 7 gcc 4.8.5), clang-tidy, cppcheck, clang-format, phpt 7.0/8.5 ZTS, 20 s fuzzing per target (1.0M / 0.5M executions).
TDD
c282691:tests/unit/test_detect_xss.c— 10 HTML attacks, 17 script-URL attacks, 19 benign values, NUL, NULL arguments, partial prefixes.data:image/svg+xml,<svg/>is correctly caught ashtmlfirst, replaced by a base64 form).🤖 Generated with Claude Code