Repository navigation
fix(hugo): satisfy check-hugo-safe-html gate (#797) - #3040
Merged
Merged
Conversation
The full-tree safe-HTML lint flagged 11 occurrences in hugo/layouts: - 2 real safeHTML pipes missing a security-reviewed: marker (render-codeblock.html diff-rejoin branch, option-tabs.html panel emit) - 9 false positives: prose comments containing the literal "safeHTML" token, which the line-level regex matches Add security-reviewed: justifications to the two real calls (both assemble HTML only from Goldmark-escaped input + constant scaffolding) and reword the prose comments to drop the literal token. No behavioral change.
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.
Problem
A DEV deploy aborted at the pre-build
check:security-annotationsgate (scripts/check-hugo-safe-html.cjs). The full-tree lint found 11 unmarkedsafeHTML/printf-HTML occurrences inhugo/layouts, none of which carried the requiredsecurity-reviewed:justification marker.Findings & fix
2 real
safeHTMLpipes missing a marker — both assemble HTML only from Goldmark-escaped input plus constant scaffolding, so they are genuinely safe; addedsecurity-reviewed:comments within the 3-line window:_default/_markup/render-codeblock.html— diff-rejoin branch ($out= Chroma output of escaped$cleanInner, re-joined with fixed line-span scaffold)shortcodes/option-tabs.html— panel emit ($inner=.Innertemplate.HTML, only fixed id/aria prefixes rewritten via constant-patternreplace)9 false positives — prose comments containing the literal word "safeHTML" (e.g. "Never apply safeHTML…"), which the line-level regex matches even though there is no actual call. Reworded to "Never mark … as raw HTML".
Verification
node scripts/check-hugo-safe-html.cjs→OK (155 files scanned), exit 0.No behavioral/output change — comments only, plus the two marker additions.
🤖 Generated with Claude Code