github-actions-hardening
Fungsinya
Tool ini memeriksa keamanan file otomatisasi GitHub Actions. Tool ini mengecek risiko tertentu yang sering luput dari alat keamanan biasa, seperti injeksi kode dan penggunaan izin (permission) yang berbahaya.
Kapan dipakai
- βSaat diminta memeriksa keamanan file otomatisasi GitHub Actions.
- βSaat membuat otomatisasi baru dan ingin memastikannya aman sejak awal.
- βSaat otomatisasi menggunakan trigger yang bisa diaktifkan oleh kode dari luar.
Link skill
https://github.com/github/awesome-copilot/blob/main/skills/github-actions-hardening/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βPeriksa keamanan file workflow GitHub Actions ini: [tempel kode di sini]β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Tool ini menganalisis trigger otomatisasi untuk memahami siapa yang bisa memulainya dan dengan izin apa. Setelah itu, tool ini mencari bagian di mana data dari luar bisa dimasukkan langsung ke dalam perintah, yang bisa berbahaya.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
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::
β¦
Pertanyaan umum
Apa itu 'privileged triggers'?
Ini adalah peristiwa yang memulai otomatisasi dan bisa dipicu oleh orang di luar proyek Anda, misalnya lewat 'pull request' dari proyek yang tidak Anda kelola. Trigger seperti ini bisa mengakses informasi sensitif.
Apa itu 'script injection' dalam konteks ini?
Ini terjadi ketika kode berbahaya disisipkan ke dalam kolom yang digunakan otomatisasi, misalnya judul 'pull request', lalu kode tersebut dijalankan seolah-olah bagian dari otomatisasi Anda.
Mengapa menggunakan 'commit SHA' dan bukan 'tag' atau 'branch' untuk merujuk ke action?
Tag dan branch bisa berubah setelah dibuat. Dengan 'commit SHA' (pengenal unik yang tetap), Anda selalu memakai versi action yang sudah diperiksa, sehingga action tidak bisa diganti dengan versi yang berbahaya.
Detail
Deskripsi asli dari pembuat
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
repo: github/awesome-copilot
Popularitas
- Bintang GitHub
- 40k
- Peringkat
- #7225
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- β¦
Skill lain dari repositori ini
acquire-codebase-knowledge
40kMembantu agent Anda memahami dan mendokumentasikan proyek kode yang sudah ada. Berguna untuk proses onboarding anggota baru atau mendapatkan gambaran arsitektur.
acreadiness-assess
40kMemungkinkan agent Anda menilai kesiapan proyek untuk AI dan membuat laporannya. Berguna untuk mengetahui seberapa siap proyek menggunakan alat AI.
acreadiness-generate-instructions
40kMembantu agent Anda membuat instruksi untuk alat AI berdasarkan hasil penilaian. Berguna untuk meningkatkan cara AI berinteraksi dengan kode dan menutup celah yang ditemukan.
acreadiness-policy
40kMemungkinkan agent Anda membantu menyusun atau menerapkan kebijakan untuk penilaian proyek AI. Berguna untuk menstandarisasi evaluasi proyek dan memastikan kepatuhan.
Skill serupa
reverse-engineer-anything
422kMembantu agent Anda memeriksa aplikasi dan paket yang sudah dirilis untuk menjelaskan fitur, membandingkan versi, atau memandu pembangunan ulang dengan alat REA.
1password
394kMembantu agent Anda mengatur CLI 1Password, masuk, serta membaca atau menyisipkan rahasia tanpa menampilkan nilainya di chat.
healthcheck
394kMembantu agent Anda mengaudit komputer atau server OpenClaw dari risiko keamanan seperti SSH, firewall, pembaruan, dan cadangan, lalu menyarankan perbaikan aman.