Skip to content

Commit 7d18883

Browse files
committed
fix xss vuln: escape HTML
1 parent b46bf6b commit 7d18883

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

docs/layouts/_partials/header/header.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,17 @@ <h5 class="offcanvas-title fw-bold" id="offcanvasNavMainLabel">{{ .Site.Params.T
147147
{{ $resource := resources.GetRemote $url }}
148148

149149
{{ if $resource }}
150-
{{ $release := $resource | transform.Unmarshal }}
151-
152-
{{ $release.name }} |
150+
{{ $release := $resource | transform.Unmarshal | default dict }}
151+
{{ if $release.name }}
152+
{{ $release.name | htmlEscape }} |
153+
{{ else }}
154+
{{ printf "⚠️ Could not parse release name (not valid JSON or missing field)\n" | warnf }}
155+
{{ printf "Media Type: %s\n" $resource.MediaType | warnf }}
156+
{{ $contentPreview := substr $resource.Content 0 500 }}
157+
{{ printf "Content Preview (first 500 chars):\n%s\n" $contentPreview | warnf }}
158+
{{ end }}
159+
{{ else }}
160+
{{ printf "❌ Release Notes Fetch failed from: %s\n" $url | warnf }}
153161
{{ end }}
154162
<a href="/changelog/pro_changelog/">
155163
<button type="button" class="btn btn-link nav-link p-2 d-none d-lg-block" aria-label="Release Notes">

0 commit comments

Comments
 (0)