-
Notifications
You must be signed in to change notification settings - Fork 0
Pitfall SRI Minify Unquoted Attributes
Tracked in #1252.
check_sri_versions's data.files_with_sri_attributes count drops sharply
(observed live on www.arleo.eu: 276 → 2) after the site is rebuilt via a
raw hugo --minify CLI invocation, then recovers (2 → 276) after the next
build_site MCP tool call rebuilds the same content.
data.findings / data.status are not affected — they stay accurate
and "clean" throughout. Do not treat this as a security or integrity
problem; it is a cosmetic undercount in a descriptive stat only.
-
build_site(internal/tools/admin/build.go) invokeshugowith--noBuildLock --cacheDir <dir> --cleanDestinationDir --destination <dir>— no--minify. Its HTML keeps quoted attributes (href="https://..."), exactly as authored in the theme templates. - A raw
hugo --minifyCLI build (used by this deployment's externalcheck-sri-versions.sh/deploy.shonhugo-vm, not by this repo) enablestdewolff/minify's HTML minifier, which strips quotes from attribute values that don't need them by default.href=https://...(no quotes) is valid HTML5, not malformed markup. -
internal/tools/admin/sri.go'ssriURLReregex hardcodes quotes:(?:src|href)="(https?://[^"]+)". Against an unquoted tag it matches nothing, so that file's<script>/<link>pairs are silently dropped from thefiles_with_sri_attributescount — but the security-relevantfindingspath (data/sri.yamllookup) is a completely separate code path and stays correct regardless.
This deployment's hugo --minify cron/deploy path had been failing on a
separate, unrelated permission bug every single run for weeks —
public/ is owned by the mcp-hugo-server-go systemd service account
once build_site has ever run, and the cron job ran as jm, so its
hugo --cleanDestinationDir call could never write there (chtimes ... operation not permitted). Minified/unquoted HTML never actually reached
production until that permission bug was fixed (2026-08-22, see
Live-Deployment-Runbook) — fixing it immediately exposed this second,
previously-dormant regex bug.
internal/tools/admin/sri.go's sriURLRe needs to accept unquoted HTML5
attribute values, not just "..."/'...'. See #1252 for the suggested
regex and a fixture-based regression test. Not yet fixed as of
2026-08-22 — this page exists so a future run of check_sri_versions
with a low files_with_sri_attributes count isn't mistaken for a real
regression before checking data.findings first.
- AgentReady Pitfalls — same general class of "two different build paths produce two different outputs" pitfall, different surface.
-
Live-Deployment-Runbook — the
hugo-vmcron/deploy permission fix that exposed this.