मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी40k · #7225

github-actions-hardening

यह क्या करती है

यह tool GitHub Actions की automation files की security की जाँच करता है। यह ऐसे खतरों को देखता है जो आम security tools से छूट जाते हैं, जैसे code injection और खतरनाक permissions का इस्तेमाल।

कब इस्तेमाल करें

  • ✓जब आपसे GitHub Actions की automation file की security जाँचने को कहा जाए।
  • ✓जब कोई नया automation बना रहे हों और शुरू से ही उसे सुरक्षित रखना चाहते हों।
  • ✓जब कोई automation ऐसे triggers इस्तेमाल करता हो जिन्हें बाहर के code से चालू किया जा सकता है।

Skill का लिंक

https://github.com/github/awesome-copilot/blob/main/skills/github-actions-hardening/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/github/awesome-copilot/blob/main/skills/github-actions-hardening/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“इस GitHub Actions workflow file की security की जाँच करो: [यहाँ code paste करें]”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह tool automation के triggers का विश्लेषण करता है ताकि समझ सके कि उसे कौन शुरू कर सकता है और किन permissions के साथ। फिर वह उन जगहों को ढूँढता है जहाँ बाहरी data सीधे commands में डाला जा रहा है, क्योंकि यह खतरनाक हो सकता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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, or issue_comment triggers
  • Questions about GITHUB_TOKEN permissions or the permissions: 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 trust
  • pull_request from 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.body
  • github.event.pull_request.title, github.event.pull_request.body, .head.ref, .head.label
  • github.event.comment.body, github.event.review.body
  • github.event.pages.*.page_name, github.event.commits.*.message, github.event.head_commit.*
  • github.head_ref and any github.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) or contents: read, then grant the minimum per job (e.g. pull-requests: write only on the job that comments).
  • Flag any permissions: write-all or broad write scopes 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::

…

अक्सर पूछे जाने वाले सवाल

'privileged triggers' क्या होते हैं?

ये वे events हैं जो automation को शुरू करते हैं और जिन्हें आपके project के बाहर के लोग भी चला सकते हैं, जैसे उन projects के 'pull requests' से जिन्हें आप नियंत्रित नहीं करते। इनके पास संवेदनशील जानकारी तक पहुँच हो सकती है।

इस संदर्भ में 'script injection' क्या है?

जब कोई दुर्भावनापूर्ण (malicious) code automation द्वारा इस्तेमाल होने वाले किसी field में डाल दिया जाता है, जैसे 'pull request' का title, और वह code आपके automation के हिस्से की तरह चल जाता है।

actions को refer करने के लिए 'tag' या 'branch' की जगह 'commit SHA' क्यों इस्तेमाल करें?

Tags और branches बनने के बाद बदले जा सकते हैं। 'commit SHA' एक अनोखा और स्थायी identifier है, जिससे आप हमेशा उसी version का इस्तेमाल करते हैं जिसकी समीक्षा हुई थी। इससे कोई उसे दुर्भावनापूर्ण version से बदल नहीं सकता।

जानकारी

लेखक का मूल विवरण

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

लोकप्रियता

GitHub स्टार
40k
रैंकिंग में स्थान
#7225
लाइसेंस
MIT
अपडेट की गई
15/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

acquire-codebase-knowledge

40k

आपके एजेंट को किसी मौजूदा code प्रोजेक्ट को समझने और उसका documentation बनाने में मदद करता है। यह नए लोगों को प्रोजेक्ट से जोड़ने या architecture का सार जानने में उपयोगी है।

लेखन और डॉक्यूमेंटडॉक्यूमेंटेशन

acreadiness-assess

40k

आपके एजेंट को किसी प्रोजेक्ट की AI के लिए तैयारी जाँचने और रिपोर्ट बनाने देता है। यह समझने में उपयोगी है कि प्रोजेक्ट AI tools इस्तेमाल करने के लिए कितना तैयार है।

लेखन और डॉक्यूमेंटडॉक्यूमेंटेशन

acreadiness-generate-instructions

40k

आपके एजेंट को assessment के आधार पर AI tools के लिए निर्देश बनाने में मदद करता है। यह बताता है कि AI कोड के साथ बेहतर कैसे काम करे और पहचानी गई कमियाँ कैसे दूर हों।

लेखन और डॉक्यूमेंटडॉक्यूमेंटेशन

acreadiness-policy

40k

आपके एजेंट को AI प्रोजेक्ट assessment के लिए नीतियाँ तय करने या लागू करने में मदद करता है। यह प्रोजेक्ट्स के मूल्यांकन को मानक बनाने और compliance सुनिश्चित करने में उपयोगी है।

AI और एजेंटएजेंट

मिलती-जुलती skills