Skip to content

fix(skills): validate percent-encoded skill names - #1431

Open
tsarlandie-oai wants to merge 4 commits into
modelcontextprotocol:mainfrom
tsarlandie-oai:fix/percent-encoded-skill-names
Open

tsarlandie-oai wants to merge 4 commits into
modelcontextprotocol:mainfrom
tsarlandie-oai:fix/percent-encoded-skill-names

Conversation

@tsarlandie-oai

@tsarlandie-oai tsarlandie-oai commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Motivation and context

Skill::validate compares a URI segment with the UTF-8 name from SKILL.md frontmatter. A skill named café therefore fails validation with NameMismatch when a server advertises skill://caf%C3%A9/SKILL.md. This came up while reviewing the filesystem catalog in #1409 and also affects servers that construct their own entries.

Percent-decode the name segment once and compare it with the frontmatter using the NFKC form used by the Agent Skills reference validator. Enforce the 1–64 character limit and allow lowercase letters, letters from scripts without case, numbers, and single internal hyphens. Invalid names now produce a distinct validation error. Agent Skills naming rules

When checking a listing for duplicate entries, use the same percent-encoding normalization as the manifest checker. This catches equivalent spellings of a skill URI while preserving the advertised URI for reads.

Tests

  • Reproduced NameMismatch on main with the new Unicode regression test. The fix accepts top-level and nested names with either hex case. Tests also cover invalid UTF-8, double encoding, and an encoded slash.
  • A list containing equivalent URI spellings now returns DuplicateSkill. The regression test covers the hex case, an escaped unreserved character, and a literal Unicode name.
  • Tests cover the 64/65-character boundary, uncased scripts, invalid name syntax, and composed and decomposed Unicode spellings. cargo test -p rmcp --lib --no-default-features passed all 193 tests.
  • cargo test -p rmcp --features client --test test_skills passed all 14 tests.
  • cargo clippy -p rmcp --lib --no-default-features -- -D warnings and cargo +nightly fmt --all -- --check passed.
  • Tested locally together with the filesystem catalog from feat: load skills from a directory tree #1409 and its follow-up fix(skills): prevent symlink swaps during catalog loads #1438. All 30 catalog tests passed. A separate test verified that a real café/SKILL.md appears under the encoded URI and returns the original Markdown through read_resource.

@tsarlandie-oai
tsarlandie-oai requested a review from a team as a code owner November 3, 2026 22:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T06:05:06.645957Z 793e02a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added T-config Configuration file changes T-core Core library changes T-model Model/data structure changes labels Nov 3, 2026
@github-actions
github-actions Bot requested a review from jamadeo November 3, 2026 22:31
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@jamadeo is on triage rotation this week and is the reviewer for this one.

Labels come from the PR labeler. Please review the change.

Automated triage. Labels are a first pass and the assigned maintainer has the final say.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94982693ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/rmcp/src/model/skill.rs Resolved
DaleSeo
DaleSeo previously approved these changes Nov 4, 2026

@DaleSeo DaleSeo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for chasing this down, @tsarlandie-oai!

Comment thread crates/rmcp/src/model/skill.rs Resolved
Comment thread crates/rmcp/src/model/skill.rs Resolved

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

T-config Configuration file changes T-core Core library changes T-model Model/data structure changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants