Skip to content

core: HTML entity decoding (TASKS 1.5) - #22

Merged
hightemp merged 3 commits into
mainfrom
core/normalize-html
Oct 22, 2026
Merged

hightemp merged 3 commits into
mainfrom
core/normalize-html

Conversation

@hightemp

Copy link
Copy Markdown
Owner

TASKS 1.5 (FR-1.3). Design note: PRD section 13, "1.5".

  • ig_html_decode(in, len, out) in src/core/ig_normalize: one pass of HTML5 character reference decoding.
    • Numeric &#N / &#xH, ; optional, leading zeros; 0, surrogates and values above 10FFFF become U+FFFD (no NUL appears).
    • Named: the attack-relevant subset (lt gt amp quot nbsp also without ;; colon lpar rpar Tab NewLine grave … with ;), case-sensitive, exposed via ig_html_entities().
    • Never longer than the input; in place allowed; no allocation, ZTS-safe.
  • ig_put_utf8 now writes 4-byte sequences.
  • Tests: tests/unit/test_html_decode.c (10 cases, including javascript: and java	script:… reaching ig_detect_xss as ATTACK), fuzz target fuzz_html_decode with seeds.

Local: unit (gcc, clang ASan/UBSan, CentOS 7), clang-tidy, clang-format, cppcheck, phpt on 7.0 NTS and 8.5 ZTS, fuzz 30 s per target, license check.

Wiring into the inspection pipeline (URL normalization → HTML decoding → XSS) comes with phases 2/4.

🤖 Generated with Claude Code

hightemp and others added 3 commits October 22, 2026 20:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ig_html_decode(): numeric references (decimal/hex, ';' optional, invalid
code points -> U+FFFD) and an attack-relevant subset of HTML5 names, with
legacy names also accepted without ';'. One pass, never longer than the
input, in place allowed. Decoding reveals &#106;avascript: and
java&Tab;script&colon; to ig_detect_xss.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hightemp
hightemp merged commit b469714 into main Oct 22, 2026
38 checks passed
@hightemp
hightemp deleted the core/normalize-html branch October 22, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant