Skip to content

fix(hugo): satisfy check-hugo-safe-html gate (#797) - #3040

Merged
jung-thomas merged 1 commit into
DEVfrom
fix-hugo-safe-html-gate-797
Nov 6, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
fix-hugo-safe-html-gate-797

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Problem

A DEV deploy aborted at the pre-build check:security-annotations gate (scripts/check-hugo-safe-html.cjs). The full-tree lint found 11 unmarked safeHTML/printf-HTML occurrences in hugo/layouts, none of which carried the required security-reviewed: justification marker.

Findings & fix

2 real safeHTML pipes missing a marker — both assemble HTML only from Goldmark-escaped input plus constant scaffolding, so they are genuinely safe; added security-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 = .Inner template.HTML, only fixed id/aria prefixes rewritten via constant-pattern replace)

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

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.
@jung-thomas
jung-thomas merged commit fdb68ec into DEV Nov 6, 2026
4 of 5 checks passed
@jung-thomas
jung-thomas deleted the fix-hugo-safe-html-gate-797 branch November 6, 2026 18:55
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