Skip to content

ci: add marketplace + skill structure validation workflow#8

Merged
zxkane merged 2 commits into
mainfrom
ci/validate-marketplace
Jun 15, 2026
Merged

ci: add marketplace + skill structure validation workflow#8
zxkane merged 2 commits into
mainfrom
ci/validate-marketplace

Conversation

@zxkane

@zxkane zxkane commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a lightweight CI check (GitHub-hosted ubuntu-latest, stdlib-only Python — no deps, no package.json needed) that validates the marketplace + skill structure on every PR/push to main. Once green, the validate-marketplace check will be added as a required status check on the main branch protection rule.

What it validates

Each is a hard failure — chosen to catch the failure classes this repo has actually hit:

  • marketplace.json is valid JSON with the expected shape; no duplicate plugin names
  • every plugin source dir exists
  • every skills[] entry resolves to a dir containing SKILL.md (catches a renamed source path that forgot a skill entry — cf. the aws-cdkaws-iac rename)
  • every SKILL.md has frontmatter with non-empty name + description
  • every committed .claude/skills/* symlink resolves to an existing dir (catches dev symlinks left dangling after a rename — the exact issue fixed in fix(.claude): repoint dev skill symlinks after aws-iac rename #7)
  • no orphan skills (every plugins/*/skills/*/SKILL.md is registered in some plugin)

Security

No untrusted input is used anywhere in the workflow; the only run: step executes a fixed script with no github.event.* interpolation. Runs with permissions: contents: read. Public-repo-safe (ubuntu-latest, no self-hosted runner).

Test Plan

  • Validator passes on current main (5 plugins, 6 skills)
  • Validator fails on a dangling .claude/skills/* symlink (verified locally)
  • Validator fails on a skills[] entry pointing at a missing dir (verified locally)
  • validate-marketplace check runs green on this PR

Adds a GitHub-hosted (ubuntu-latest, public-repo-safe) check that runs a
stdlib-only Python validator on every PR/push to main. It guards the
exact failure classes this repo has hit:

- marketplace.json is valid JSON with the expected shape
- every plugin `source` dir exists; every `skills[]` entry resolves to a
  dir with a SKILL.md (catches a renamed source path with a stale entry)
- every SKILL.md has frontmatter with name + description
- every committed .claude/skills/* symlink resolves (catches dev symlinks
  left dangling after a plugin rename — cf. the aws-cdk -> aws-iac rename)
- no orphan skills unregistered in any plugin

The workflow uses no untrusted input and runs with contents:read only.
Once green on main, the `validate-marketplace` check is set as a required
status check on the branch protection rule.

@amazon-q-developer amazon-q-developer 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.

Summary

This PR adds a valuable CI validation workflow for marketplace structure. The implementation is well-structured and follows security best practices for GitHub Actions. However, 4 critical issues must be addressed before merge:

Critical Issues

  1. Missing error handling in frontmatter() - file read operations can crash the script
  2. Missing directory existence check in check_all_skill_frontmatter() - will crash if plugins/ doesn't exist
  3. Path traversal vulnerability in check_dev_symlinks() - malicious symlinks can expose filesystem paths outside the repository (CWE-22)
  4. KeyError risk in main() - unsafe dictionary access can crash when JSON is malformed

All issues have commit-able fix suggestions. Once resolved, this workflow will provide robust validation for the repository structure.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread scripts/ci/validate_marketplace.py Outdated
Comment thread scripts/ci/validate_marketplace.py Outdated
Comment thread scripts/ci/validate_marketplace.py Outdated
Comment thread scripts/ci/validate_marketplace.py
Address Amazon Q review findings on the validator:
- frontmatter(): wrap read_text in try/except OSError, report + treat as
  empty rather than crashing on an unreadable SKILL.md
- check_all_skill_frontmatter(): guard against a missing plugins/ dir
  before rglob() instead of raising FileNotFoundError
- check_dev_symlinks(): flag symlinks that resolve outside the repo
  (supply-chain hygiene) before the existence check
- main(): use isinstance(plugins, list) for the summary count so a
  malformed (non-list) plugins value can't raise
@zxkane
zxkane merged commit 68530c6 into main Jun 15, 2026
1 check passed
@zxkane
zxkane deleted the ci/validate-marketplace branch June 15, 2026 14:37
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