Skip to content

fix: validate percent-encoded reference anchors - #748

Closed
ayobamiseun wants to merge 1 commit into
addyosmani:mainfrom
ayobamiseun:fix/encoded-reference-anchors
Closed

ayobamiseun wants to merge 1 commit into
addyosmani:mainfrom
ayobamiseun:fix/encoded-reference-anchors

Conversation

@ayobamiseun

Copy link
Copy Markdown
Contributor

The reference-link validator can skip anchors that begin with a percent escape or validate only the prefix before an escape. This can accept invalid links and reject valid encoded heading anchors.

Capture the complete percent-encoded fragment and decode it once before comparing it with heading anchors. Malformed encodings produce the existing missing-heading diagnostic instead of throwing. Add nine regression cases covering encoded ASCII, Unicode, missing headings, double encoding, and malformed escapes.

Validation on this isolated branch:

  • All 222 validator and eval-runner tests passed.
  • Skill, manifest-version, reference-link, command, and artifact-path validators passed.
  • node scripts/run-evals.js --min-rank1 95: 143 checks passed; trigger rank-1 rate 100%.
  • git diff --check passed.

This is the validator portion of #745, submitted separately for independent review.

@addyosmani

Copy link
Copy Markdown
Owner

Thanks. I'm going to pass on this one: no link in the repo uses a percent-encoded anchor, so it guards a case we don't have and adds 40 lines to a shared script. Same call as #697 and #703. If one shows up and the check gets it wrong, a PR with that link would be an easy yes. Closing.

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.

2 participants