Skip to content

fix(skills): prevent a skill name from escaping the upload directory - #104

Open
Oskii wants to merge 3 commits into
anthropics:mainfrom
Oskii:reject-skill-name-path
Open

Oskii wants to merge 3 commits into
anthropics:mainfrom
Oskii:reject-skill-name-path

Conversation

@Oskii

@Oskii Oskii commented Sep 25, 2026

Copy link
Copy Markdown

fix(skills): prevent a skill name from escaping the upload directory

Problem

A name in SKILL.md reaches the multipart filename without a check that it is one path segment. path.Join turns ../../other into ../../other/SKILL.md. A receiver that treats that name as a tree path can place the file outside the skill folder, when someone applies a skill whose manifest they did not write.

Fix

loadSkillDir rejects a name that contains /, \, or .. before the bundle is built. That keeps every uploaded filename under one directory. The patch is limited to that check in skill.go.

Verification

  • TestSkillNameCannotBeAPath loads ../../other, /other, ..\other, foo/bar, .., and foo..bar, and each one is refused. pr-writer still uploads as pr-writer/SKILL.md.
  • go test ./internal/declarative/claude/ -count=1 — passed.

Compatibility

A skill whose name is already a single segment is unchanged. A name that contains /, \, or .. fails at load, before any upload. foo..bar is refused because it contains ...

The manifest name is the multipart folder. path.Join was turning a name like ../../other into a filename outside that folder.
@Oskii
Oskii requested a review from a team as a code owner September 25, 2026 10:53
EvanPaules pushed a commit to EvanPaules/anthropic-cli that referenced this pull request Oct 1, 2026

This branch has not been deployed

No deployments
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