Fix YAML frontmatter injection in event submission workflow#5
Merged
Conversation
3 tasks
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>
e51659d to
48e652c
Compare
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.
Summary
yaml.safe_dump()— prevents frontmatter injection via unescaped"or newlines in issue body fields (title, location, URL, dates)unsaferenderervirtualfield type: was written as the string'true'/'false'; now serialized as a proper YAML booleanSecurity 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
"in the event name and verify the generated.mdfrontmatter is correctly escaped<script>alert(1)</script>in the description and verify it is stripped from the output file🤖 Generated with Claude Code