Skip to content

Fix YAML frontmatter injection in event submission workflow#5

Merged
HeyItsGilbert merged 1 commit into
mainfrom
security/fix-yaml-injection
May 26, 2026
Merged

Fix YAML frontmatter injection in event submission workflow#5
HeyItsGilbert merged 1 commit into
mainfrom
security/fix-yaml-injection

Conversation

@HeyItsGilbert
Copy link
Copy Markdown
Member

Summary

  • Replaces hand-rolled f-string YAML serialization with yaml.safe_dump() — prevents frontmatter injection via unescaped " or newlines in issue body fields (title, location, URL, dates)
  • Strips raw HTML tags from event descriptions before writing to markdown, blocking stored XSS through goldmark's unsafe renderer
  • Fixes virtual field type: was written as the string 'true'/'false'; now serialized as a proper YAML boolean

Security context

Community event submissions are written from GitHub issue body content (untrusted input) into Hugo content files. The previous f-string interpolation allowed a crafted issue to break out of YAML string quoting and inject arbitrary frontmatter fields, or embed raw <script> tags in the rendered page.

Test plan

  • Submit a test event issue with " in the event name and verify the generated .md frontmatter is correctly escaped
  • Submit a test event issue with <script>alert(1)</script> in the description and verify it is stripped from the output file
  • Verify a normal event submission still generates a valid content file and the PR renders correctly in Hugo

🤖 Generated with Claude Code

Replace hand-rolled f-string YAML serialization with yaml.safe_dump() to
prevent frontmatter injection via unescaped quotes in issue body fields.
Strip raw HTML from event descriptions to block stored XSS through
goldmark's unsafe renderer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HeyItsGilbert HeyItsGilbert force-pushed the security/fix-yaml-injection branch from e51659d to 48e652c Compare May 26, 2026 14:44
@HeyItsGilbert HeyItsGilbert merged commit 182f7a9 into main May 26, 2026
1 check passed
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