Fixes #7086 — adds a new XSS context analyzer that uses golang.org/x/net/html tokenizer to accurately classify where user input is reflected in HTML responses.
Addresses all 4 issues from #7086:
javascript: URI detection in href/src/action attributesapplication/json, importmap, etc.)srcdoc attribute handling as nested HTML contextWhat’s included:
xss analyzer package (pkg/fuzz/analyzers/xss/) with 8 reflection contextsinit() registrationResponseBody and ResponseHeaders fields added to analyzers.OptionsThe analyzer uses Go’s golang.org/x/net/html tokenizer to parse HTML and detect reflection contexts:
ContextHTMLText — between tagsContextAttribute — inside attribute valuesContextScript — inside executable <script> blocksContextComment — inside HTML commentsContextTag — inside tag definitionsContextStyle — inside <style> blocksContextJavascriptURI — inside javascript: URI attributesContextNonExecutableScript — inside non-executable script types (JSON, importmap)Each reflection includes character availability analysis (<, >, ", ', etc.) to help determine viable XSS payloads.
go test ./pkg/fuzz/analyzers/xss/ -v)go build ./pkg/fuzz/analyzers/...)go build ./pkg/protocols/http/...)/claim #7086
🤖 Generated with Claude Code
New Features
Tests
kgatilin
@kgatilin
Bishnu Prasad Sahu
@mebishnusahu0595