Tier: single-user local tool and rendering library.
highlight is a Go standard-library syntax highlighter that tokenizes
source code and emits HTML-escaped <span> elements (Code and
Diff). It makes no network requests, filesystem writes, or subprocess
calls.
- Untrusted source text or diffs passed into
CodeorDiffattempting HTML/XSS injection or quadratic CPU and memory exhaustion during scanning. - A compromised dependency in
tools.mod.
Resolve scanner findings in these areas as accepted_risk instead of
adding defensive code:
- Caller-controlled input size:
highlightkeeps scanners linear with bounded carried state, while the calling application enforces overall input byte limits. - Host application CSS and CSP: The host application owns its
stylesheet and
Content-Security-Policyheaders.highlightemits only fixedhl-*class names and HTML-escaped text. - Local process compromise: An attacker who controls the calling Go process already owns its memory and output.