Repository navigation
Track libinjection 4.0.1 - #7
Merged
Merged
Conversation
The libinjection-c submodule had been pinned at 85e252a (2025-02-28) since the
initial port, 87 upstream commits behind v4.0.1. The differential test and the
fuzz campaign compared the port against that old C code, and libinjection
issue 90 reported an over-read that 4.0.0 had already fixed.
Port the detection changes since the pin:
- parse_number: "1.e" with no exponent digits assigns no token (was a bareword)
- fold: "LIKE (" is a function only when it does not follow an operand
- h5_skip_white: reads bytes unsigned, so 0xFF is no longer CHAR_EOF
- BLACKATTREVENT: regenerated from v4.0.1 (432 entries, C order)
- html_decode_char_at and the on* comparison mirror 4.0.1's length guards
(no verdict change: the port never read past the slice)
The 4.0 error-code API (LIBINJECTION_RESULT_ERROR) is not mirrored: C returns
it only for NULL pointers and broken parser invariants, which Rust types rule
out.
Tests: two XSS fuzz tests asserted the old C verdict for 0xFF inputs; C 4.0.1
flags both, and they are now also checked against C in comparison-bin. The
NUL-as-whitespace differential used an input whose verdict no longer depends
on NUL; it now uses one that fails when NUL handling is removed, and keeps the
fuzz input. Add a 0xFF tokenizer test mirroring upstream's
test_error_handling.c.
Harness: drop the hard-coded LIBINJECTION_VERSION="3.10.0" (4.0.1 defines its
own). Add Dependabot for the submodule.
Corpus: 0 SQLi and 0 XSS divergences from C over 163,275 inputs.
|
Caution Review failedThe pull request is closed.
Tip 🎯 Customize your risk assessments
✅ Automatic approvals, with your rules
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
ndreno
marked this pull request as ready for review
November 3, 2026 17:46
Merged
ndreno
added a commit
that referenced
this pull request
Nov 3, 2026
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.
Moves the
libinjection-csubmodule from 85e252a (2025-02-28, the commit pinned in the initial port) to v4.0.1, and ports the detection changes in between.Why
The pin was 87 upstream commits behind. CI checks out the pinned commit, so the differential test and the fuzz campaign were comparing the port against February 2025 C code. Upstream issue 90 (an over-read in
html_decode_char_at) turned out to be already fixed in 4.0.0.What changed upstream, and what the port does
parse_number:1.e/10.Ewith no exponent digits assigns no token (was a bareword)sqli/tokenizer.rsLIKE (is a function only when it does not follow a number, string, bareword, variable or)(upstream PR 94)sqli/mod.rsh5_skip_whitereads bytes unsigned, so 0xFF is no longerCHAR_EOF(upstream PR 93)xss/html5.rs(Option<u8>,None= EOF)BLACKATTREVENT: 145 names added, 11 removed, re-sortedhtml_decode_char_at:len < 3 || (hex && len < 4)guard (the issue 90 fix)is_black_attr: on* compare capped atmin(len - 2, strlen(name))min. No verdict change, same reasoninjection_result_t/LIBINJECTION_RESULT_ERROR, asserts replaced by error returnssqlparse_data.jsonregeneratedTests
test-tokens-numbers-exp-001/009-012,test-folding-099/100/119failed, and pass after.data/xss-github-92.txthas%FF, read literally). Added a tokenizer test mirroring upstream'stest_error_handling.c; it fails with the pre-porthtml5.rs.test_fuzz_differential_crash_472cde1candtest_fuzz_differential_8ce9746basserted the old C verdict (Safe) for inputs with 0xFF. C 4.0.1 flags both; expectations updated, and both inputs are now also checked against the live C incomparison-bin.nul_as_whitespace_in_html5_matches_the_c_library: its fuzz input now reaches a backtick comment after the 0xFF, so its verdict no longer depends on NUL handling. Added<a x=y\0onclick=alert(1)>, which fails when NUL is removed from the whitespace helpers, and kept the fuzz input with C's 4.0.1 verdict.Also
-DLIBINJECTION_VERSION="3.10.0"(4.0.1 defines its own). The zero padding stays..github/dependabot.yml: weeklygitsubmoduleupdates, so upstream changes open a PR that the differential job runs against. Dependabot tracks upstreammain, not release tags.nonminimal_boolon!(have_e && !have_exp)and a range suggestion on the0x0B | 0x0C | 0x0Dcase.Note for consumers: detection changes in this version. More XSS is flagged (new event names, attributes after a 0xFF byte), and
1.e-style SQLi is now flagged.