github-actions-hardening
Skill1 starsChanged 13 days agoMITView on GitHub
Security hardening reviewer for GitHub Actions workflow files (.github/workflows/*.yml). Reasons about the Actions threat model that pattern matchers and general code linters miss — untrusted-input script injection, privileged triggers running fork code, mutable action references, and over-scoped tokens. Use this skill when asked to review, audit, harden, or secure a GitHub Actions workflow, when writing a new workflow, or for any request like "is this workflow safe?", "review my CI for security issues", "why is pull_request_target dangerous here?", "pin my actions", or "lock down GITHUB_TOKEN permissions". Covers script injection via ${{ }} interpolation, pull_request_target / workflow_run privilege escalation, SHA-pinning of third-party actions, least-privilege permissions, GITHUB_ENV/GITHUB_OUTPUT injection, secret exposure, OIDC over long-lived credentials, and self-hosted runner exposure on public repositories.
- Reads credentials
7 other projects use a version of this, 2 of them edited; 1 new project in the last 4 weeks, against 0 the 4 before.
Adopted by
Surging: 1 new project took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- docdyhr/simplenote-mcp-serverword for word, first seen Nov 1, 2026
- kaandgnsh/Claude-Bluetheir own version, first seen Nov 1, 2026
- github/awesome-copilotword for word, first seen Oct 25, 2026
- sb-dev/narrative-production-skillsword for word, first seen Oct 20, 2026
- z-Zihan/Evirtheir own version, first seen Oct 13, 2026
- exelearning/exelearningedited, first seen Oct 8, 2026
Other versions7 projects use a version of this.
Word for word · 3
- github/awesome-copilot★ 41k100% same
- docdyhr/simplenote-mcp-server★ 21100% same
- sb-dev/narrative-production-skills★ 2100% same
Edited · 2
- exelearning/exelearning★ 15398% same
- RorroRojas3/maf-agents★ 097% same
Wrote their own version · 2
- z-Zihan/Evir★ 11same name
- kaandgnsh/Claude-Blue★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository95 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- agent-architectureSkill
- agentic-evalSkill
- agent-owasp-complianceSkill
- agent-skill-stackSkill
- ai-readySkill
- ai-team-orchestrationSkill
- answer-me-with-htmlSkill
- anti-ui-slopSkill
- archifySkill
- autoresearchSkill
- batch-script-progressSkill
- cli-creatorSkill
- codebase-designSkill
- code-exemplars-blueprint-generatorSkill
- copilot-instructions-blueprint-generatorSkill
- create-agentsmdSkill
- create-architectural-decision-recordSkill
- create-github-action-workflow-specificationSkill
- create-github-issues-feature-from-implementation-planSkill
- create-readmeSkill
- create-specificationSkill
- create-technical-spikeSkill
- create-tldr-pageSkill
- docs-sync-auditSkill
- folder-structure-blueprint-generatorSkill
- gh-fix-ciSkill
- github-repo-careSkill
- impeccableSkill
- launchd-automationSkill
- mcp-security-auditSkill
- notion-cliSkill
- opencode-model-routerSkill
- playwright-cliSkill
- python-pypi-package-builderSkill
- refactorSkill
- simple-englishSkill
- swiftui-expert-skillSkill
- technical-documentationSkill
- workshop-driverSkill
- xerj-hubSkill
- xerjSkill
- anti-ui-slopSkill
- autoresearchSkill
- batch-script-progressSkill
- calling-frontend-from-tauri-rustSkill
- calling-rust-from-tauri-frontendSkill
- cli-creatorSkill
- codebase-designSkill
- code-exemplars-blueprint-generatorSkill
- configuring-tauri-appsSkill
- configuring-tauri-capabilitiesSkill
- configuring-tauri-cspSkill
- configuring-tauri-permissionsSkill
- configuring-tauri-scopesSkill
- copilot-instructions-blueprint-generatorSkill
- create-agentsmdSkill
- create-architectural-decision-recordSkill
- create-github-action-workflow-specificationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 3 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use this skill when the request involves:
- Distinctive: line 45
Follow these steps in order for every workflow reviewed.
- Very specific: line 49
Read every on: trigger and classify the workflow's privilege:
- Very specific: line 57
Read references/triggers-and-privilege.md for the full trust matrix.
- Very specific: line 71
Read references/injection.md for the complete sink list and the safe-pattern fixes.
- Very specific: line 75
If a pull_request_target or workflow_run workflow checks out PR/fork code (ref: ${{ github.event.pull_request.head.sha }}) and then runs it …
- Very specific: line 84
If there is no permissions: block, the workflow inherits the repository default, which may be read/write to everything.
- Very specific: line 90
Read references/permissions-and-tokens.md for the per-scope guidance and OIDC setup.
- Very specific: line 104
Read references/supply-chain.md for pinning, Dependabot for actions, and artifact/cache risks.
- Very specific: line 108
No secrets echoed, printed, or written to logs.
- Distinctive: line 140
If the workflow is already hardened, say so and list what was checked.
- Very specific: line 148
Search patterns: pull_request_target, workflow_run, issue_comment, fork, secrets, read-only token, trust boundary
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub Actions Hardening
A focused security reviewer for GitHub Actions workflows. It reasons about the Actions-specific
threat model — where trust boundaries live in trigger types, token scopes, and string
interpolation — rather than the application-code vulnerabilities a general security scanner looks
for. Most workflow risks are invisible to language linters because the dangerous code is the YAML
itself and the way GitHub expands ${{ }} expressions into a shell before your script runs.
When to Use This Skill
Use this skill when the request involves:
- Reviewing, auditing, or hardening any file under
.github/workflows/ - Authoring a new workflow and wanting it secure by default
- A workflow that uses
pull_request_target,workflow_run, orissue_commenttriggers - Questions about
GITHUB_TOKENpermissions or thepermissions:key - Pinning actions to commit SHAs vs tags vs branches
- Handling untrusted input (issue titles, PR bodies, branch names, commit messages) in
run:steps - OIDC / cloud authentication from Actions, or secret handling in CI
- Self-hosted runners on public repositories
- Any request like "is this workflow safe?", "secure my CI", or "review this GitHub Action"
The Core Insight
In a workflow, ${{ <expr> }} is expanded by the runner into the script before the shell
executes it. So a step like:
- run: echo "Title: ${{ github.event.issue.title }}"is not passing a variable — it is pasting attacker-controlled text directly into your shell
command. An issue titled "; <attacker-command> # is concatenated into the script and executed.
This single mechanism is the most common real-world Actions vulnerability, and models routinely
generate it. Treat every
${{ }} that contains data an outside contributor can influence as a code-injection sink.
Execution Workflow
Follow these steps in order for every workflow reviewed.
Step 1 — Map the Triggers and Trust Level
Read every on: trigger and classify the workflow's privilege:
push,pull_request(from same repo) → runs with the contributor's own trustpull_requestfrom a fork → runs with a read-only token, no secrets (safe by design)pull_request_target,workflow_run,issue_comment,issues→ run in the context of the base repository with a read/write token and full access to secrets, but can be triggered by outside contributors. These are the dangerous triggers.
Read references/triggers-and-privilege.md for the full trust matrix.
Step 2 — Hunt for Script Injection
For every run: block, every script: in actions/github-script, and every input to a custom
action, list the ${{ }} expressions and check whether any resolve to attacker-controllable data.
High-risk contexts include:
github.event.issue.title,github.event.issue.bodygithub.event.pull_request.title,github.event.pull_request.body,.head.ref,.head.labelgithub.event.comment.body,github.event.review.bodygithub.event.pages.*.page_name,github.event.commits.*.message,github.event.head_commit.*github.head_refand anygithub.event.*field a fork author can set
Read references/injection.md for the complete sink list and the safe-pattern fixes.
Step 3 — Check Privileged Triggers Don't Execute Untrusted Code
If a pull_request_target or workflow_run workflow checks out PR/fork code
(ref: ${{ github.event.pull_request.head.sha }}) and then runs it (build, test, install
scripts, npm install with lifecycle scripts, etc.), that is remote code execution against a
privileged token. Flag it as CRITICAL. The safe pattern is to split into two workflows: an
unprivileged pull_request workflow that runs the untrusted code, and a privileged
workflow_run workflow that only consumes its results.
Step 4 — Audit permissions:
- If there is no
permissions:block, the workflow inherits the repository default, which may be read/write to everything. Flag it. - Recommend a top-level
permissions: {}(deny-all) orcontents: read, then grant the minimum per job (e.g.pull-requests: writeonly on the job that comments). - Flag any
permissions: write-allor broadwritescopes that the steps don't actually need.
Read references/permissions-and-tokens.md for the per-scope guidance and OIDC setup.
Step 5 — Audit Action References (Supply Chain)
For every uses::
- Third-party actions (not
actions/*orgithub/*) MUST be pinned to a full 40-character commit SHA, not a tag or branch. Tags and branches are mutable; a compromised upstream action can rewritev1to malicious code that runs with your token and secrets. - First-party
actions/*are lower risk but SHA-pinning is still the hardened recommendation. - Flag
@main,@master, or any branch reference as HIGH — that is "latest" and can change under you at any time. - Note the human-readable version in a trailing comment:
uses: foo/bar@<sha> # v2.1.0.
Read references/supply-chain.md for pinning, Dependabot for actions, and artifact/cache risks.
Step 6 — Check Secret and Output Handling
- No secrets echoed, printed, or written to logs; no
set -x/bash -xin steps that touch secrets. - Secrets must not be passed to steps that run untrusted code or to untrusted third-party actions.
- Untrusted multiline data written to
$GITHUB_ENVor$GITHUB_OUTPUTcan inject environment variables or step outputs — use the random-delimiter heredoc form and never write raw user input. actions/checkoutleaves a token on disk by default; setpersist-credentials: falsewhen the job later runs untrusted code.
Step 7 — Produce the Report
Output findings using the format in references/report-format.md: a severity summary table first,
then grouped findings with file, the exact offending YAML, the risk in plain English, and a
concrete before/after fix. Never auto-apply changes — present them for review.
Severity Guide
| Severity | Meaning | Example |
| 🔴 CRITICAL | Token/secret theft or RCE reachable by an outside contributor | pull_request_target checking out and running fork code; ${{ github.event.* }} in a run: on a privileged trigger |
| 🟠 HIGH | Exploitable supply-chain or scope problem | Third-party action on a mutable tag/branch; write-all permissions; injection sink on issue_comment |
| 🟡 MEDIUM | Risk under conditions or chaining | Missing permissions: block; secret reachable by a non-fork PR author |
| 🔵 LOW | Hardening gap, low direct risk | First-party action not SHA-pinned; persist-credentials left default on a non-privileged job |
| ⚪ INFO | Observation, not a vulnerability | Version comment missing next to a pinned SHA |
Output Rules
- Always show a findings summary table (counts by severity) first.
- Group by issue type, not by file.
- Be exact — quote the offending line and give the line location.
- Always pair every CRITICAL/HIGH with a concrete corrected YAML snippet.
- Never claim a fork
pull_requestis dangerous just because it runs untrusted code — it has no secrets and a read-only token. Reserve CRITICAL for the privileged triggers. - If the workflow is already hardened, say so and list what was checked.
Reference Files
Load these as needed:
references/triggers-and-privilege.md— Trust matrix for every trigger, whypull_request_targetandworkflow_runare privileged, and the two-workflow safe pattern.- Search patterns:
pull_request_target,workflow_run,issue_comment,fork,secrets,read-only token,trust boundary
- Search patterns:
references/injection.md— Full list of attacker-controllable${{ }}contexts and theenv:-variable safe pattern for each sink (run,github-script, action inputs).- Search patterns:
script injection,github.event,head_ref,issue title,env,intermediate variable,actions/github-script
- Search patterns:
references/permissions-and-tokens.md—GITHUB_TOKENscopes, least-privilegepermissions:recipes per job type, and OIDC for cloud auth instead of long-lived secrets.- Search patterns:
permissions,GITHUB_TOKEN,write-all,contents: read,id-token,OIDC,least privilege
- Search patterns:
references/supply-chain.md— SHA-pinning third-party actions, Dependabot forgithub-actions, artifact and cache poisoning acrossworkflow_run, and self-hosted runner exposure.- Search patterns:
SHA pin,uses,mutable tag,Dependabot,download-artifact,cache,self-hosted runner
- Search patterns:
references/report-format.md— Output template: summary table, finding cards, and before/after remediation blocks.- Search patterns:
report,format,finding,summary,remediation,before,after
- Search patterns:
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
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.

