Repository navigation
Parse SKILL.md with maintained YAML fork - #6919
Merged
Merged
Conversation
gopkg.in/yaml.v3 v3.0.1 panics with "hash of unhashable type" when a mapping holds a merge key next to a mapping-valued key, so a crafted SKILL.md crashes ParseSkillMD instead of returning an error. OSS-Fuzz found this through FuzzParseSkillMD (testcase 4870994700075008). Switch pkg/skills to go.yaml.in/yaml/v3, the maintained fork with the same API, which returns an error for this input. The parser, the StringOrSlice unmarshaler and its test move together because a custom UnmarshalYAML only fires when the decoder comes from the same library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6919 +/- ##
==========================================
- Coverage 79.83% 79.80% -0.04%
==========================================
Files 827 828 +1
Lines 84553 84632 +79
==========================================
+ Hits 67506 67543 +37
- Misses 17042 17084 +42
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ChrisJBurns
approved these changes
Oct 22, 2026
jhrozek
approved these changes
Oct 22, 2026
rdimitrov
deleted the
claude/oss-fuzz-testcase-4870994700075008-18aa9d
branch
October 22, 2026 13:53
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
FuzzParseSkillMD, testcase 4870994700075008) found that a craftedSKILL.mdpanicsParseSkillMDwithruntime error: hash of unhashable type map[string]interface {}. The panic comes fromgopkg.in/yaml.v3v3.0.1: when a mapping has a<<merge key, the decoder records every sibling key in a Go map, and a mapping-valued key (? {a: b}) cannot be a map key.gopkg.in/yaml.v3is unmaintained, so the fix will not land there. Skill content comes from git repositories and OCI artifacts, so a malicious skill could crashthv skill install.pkg/skillsnow decodes frontmatter withgo.yaml.in/yaml/v3v3.0.5, the maintained fork with the same API, which returns an error for this input. It was already ingo.modas an indirect dependency and is now direct.parser.go,types.go(theStringOrSliceunmarshaler) andparser_test.goswitch together: a customUnmarshalYAML(*yaml.Node)only fires when the decoder comes from the same library, otherwiseallowed-tools: Read Globsilently stops being split.TestParseSkillMDcase expectinginvalid frontmatter.Type of change
Test plan
go test ./pkg/skills/...)Reproduced the panic with the crash input on
main(same stack as OSS-Fuzz); after the change it returnsinvalid frontmatter. Rango test ./pkg/skills -fuzz '^FuzzParseSkillMD$' -fuzztime 60s(~2.4M execs, no crash) andgo vet ./pkg/skills/.Does this introduce a user-facing change?
Before: a
SKILL.mdwhose frontmatter combines a<<merge key with a mapping-valued key crashed the process. After: it is rejected withinvalid frontmatter. Valid skills parse as before.Special notes for reviewers
Other packages still import
gopkg.in/yaml.v3; moving them to the fork is a separate PR so this fix stays small.🤖 Generated with Claude Code