agentleFS
SpeakingColorsSpeakingColors/claude-skills/skills/gha-supply-chain-hardening/SKILL.md

gha-supply-chain-hardening

Skill0 starsChanged 24 days agoMITView on GitHub

Use to harden GitHub Actions and CMake dependencies across many repos: pin actions to commit SHAs, default read-only token, pin FetchContent to commits, verify with scans, optional attestations.

  • Reads credentials
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check workflows for write needs first: grep for gh release, action-gh-release, git push, GITHUB_TOKEN, secrets..

    line 22
  2. Very specific:

    Verify at the end: no uses: line without a 40 hex SHA, no workflow without top-level permissions:, no GIT_TAG main.

    line 23

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GitHub Actions and CMake supply chain hardening

Companion to plugin-ship-checklist and github-repo-lockdown. Labels: MEASURED (done across 46 plugin repos), VERIFIED (source page), UNVERIFIED.

The four changes, in order of value

  1. Pin every action to a full commit SHA and keep the version in a comment: uses: actions/checkout@<sha> # v4. SHA pinning is the mainstream defence after the tj-actions compromise. VERIFIED (Semgrep blog, 2026). A SHA can still point at a commit in a malicious fork, so pinning is not a full answer. VERIFIED (platformengineering.org).
  2. Top level permissions: contents: read in every workflow, widen per job only (release upload needs contents: write). Never use pull_request_target with a checkout of fork code. Background knowledge, UNVERIFIED.
  3. Pin CMake FetchContent_Declare(... GIT_TAG <full commit sha>). A branch name like main means any push to that repo changes your builds. CMake 3.28 accepted a commit SHA together with GIT_SHALLOW ON. MEASURED.
  4. Publish SHA256SUMS with every release. UNVERIFIED as practice, cheap.

Getting the SHA

git ls-remote https://github.com/actions/checkout refs/tags/v4 refs/tags/v4^{}. For a lightweight tag only one line prints and that SHA is the commit. For an annotated tag use the ^{} line. MEASURED for checkout, upload-artifact, download-artifact, cache, setup-python.

Rewriting many repos safely

  • Script the edit with sed -E anchored on @v4 followed by space or end of line, so @v4.1 is not touched. Insert the permissions block before the first ^jobs: only when no top-level permissions: exists. Parse every workflow with a YAML loader after editing. MEASURED.
  • Work from a fresh git fetch --depth=1 plus reset --hard FETCH_HEAD for each repo, never a stale clone: another session may have pushed. A stale clone gave a non-fast-forward rejection. MEASURED.
  • Check workflows for write needs first: grep for gh release, action-gh-release, git push, GITHUB_TOKEN, secrets.. Only those need a wider job-level block. MEASURED.
  • Verify at the end: no uses: line without a 40 hex SHA, no workflow without top-level permissions:, no GIT_TAG main. MEASURED.

After pinning

  • Dependabot security alerts do not see SHA pins, so keep the # vX comment and enable Dependabot version updates for the github-actions ecosystem, which rewrites pins. The version updates part is UNVERIFIED.
  • Build provenance: actions/attest-build-provenance needs id-token: write and attestations: write; users check with gh attestation verify FILE -R owner/repo. Attestations alone give SLSA build level 2. VERIFIED (GitHub docs).
  • GitHub org policy can block unpinned actions. VERIFIED (GitHub changelog 2025-08-15). Not available to personal accounts: UNVERIFIED.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.