CWE-250 · CWE-522 · GHA017 · GHA018 · GHA020

Fix GitHub Actions permissions: write-all & persist-credentials: false

Eliminate over-privileged GITHUB_TOKEN blast radius (GHA017, GHA018) and stop actions/checkout from caching credentials in .git/config (GHA020). Audit your private workflows locally—0 bytes uploaded.

Scan Workflow (0 Upload) Pro CLI Pack $49 →

0 bytes uploaded · 0 GitHub OAuth · One-time local CLI & automated hardening diff via Polar.sh.

Least-Privilege GITHUB_TOKEN (GHA017/018) persist-credentials: false (GHA020) SOC 2 CC6.3 / CC8.1 · CIS GHA 0 Network Requests During Scan
Drop private .github/workflows/*.yml files here or paste YAML below to check GITHUB_TOKEN permissions and generate an offline hardening diff.
Deterministic YAML AST · 0 bytes sent

Offline Hardened YAML Diff Preview


      

Vulnerable vs. Least-Privilege Permissions YAML

Setting permissions: write-all hands every build tool and transitive npm/Python postinstall hook full repository write access. Declare permissions: contents: read at the workflow root, scope write grants to specific jobs only, and set persist-credentials: false on actions/checkout.

Vulnerable · GHA018 · GHA020 · GHA001 · GHA028
name: Build and Test
on:
  pull_request:
    branches: [main]

permissions: write-all

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: "20"
      - run: npm ci && npm test
Hardened · 100/100 (Grade A · 0 Findings)
name: Build and Test
on:
  pull_request:
    branches: [main]

permissions:
  contents: read

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          persist-credentials: false
      - uses: actions/setup-node@39370e3970a6d050c480ffad7ff0ed4d3fdee5af # v4.1.0
        with:
          node-version: "20"
      - run: npm ci && npm test

GitHub Actions Token & Credential Rules Checked

Rule CWE Misconfiguration Least-Privilege Fix
GHA017 CWE-250 Missing top-level or job-level permissions: block Add explicit permissions: { contents: read } at workflow root.
GHA018 CWE-250 permissions: write-all granted to workflow or job Replace with minimal per-job scopes (e.g., contents: read, packages: write).
GHA019 CWE-269 High-risk write permission granted on untrusted PR trigger Keep PR test jobs read-only; isolate write actions into gated workflows.
GHA020 CWE-522 actions/checkout omits persist-credentials: false Set persist-credentials: false so .git/config never stores the token.
GHA022 CWE-269 id-token: write declared globally at top-level Move id-token: write strictly into the single deploy/attestation job that mints OIDC JWTs.

Enforce Least-Privilege Permissions Across Every Repo Locally

Audit every repository folder in one command with runnerproof-cli --repos-dir and export SARIF 2.1.0 plus an auditor-signed SOC 2 CC8.1 / EU CRA Art. 14 dossier:

Buy RunnerProof Solo CLI ($49 One-Time) Buy RunnerProof Team & CRA/SOC 2 Pack ($99 One-Time)

Frequently Asked Questions

Why is permissions: write-all dangerous in GitHub Actions?

It grants the runner's GITHUB_TOKEN write access to repository contents, releases, packages, and deployments—turning any compromised test or dependency into full repository takeover.

Why should actions/checkout always set persist-credentials: false?

Without it, actions/checkout leaves the GITHUB_TOKEN inside .git/config, allowing any later script or malicious package hook to extract and replay the token.

How should I grant write permissions when only one job deploys?

Set workflow-level permissions: contents: read as a safe default, then add specific write scopes only inside the single deploy or release job protected by a GitHub environment gate.

Related GitHub Actions Remediation Guides

CVE-2025-30066 & reviewdog Fix

Audit tj-actions/changed-files and reviewdog/action-setup IOCs and auto-pin 40-char SHAs.

Read CVE-2025-30066 Guide

Script Injection Remediation

Move ${{ github.event.* }} expressions into safe env: bindings to eliminate shell RCE.

Read Script Injection Guide

SOC 2 CC8.1 & EU CRA Guide

Generate tamper-evident CI/CD audit evidence packs for SOC 2 CC8.1 and EU CRA Art. 14.

Read SOC 2 / CRA Guide

Oriancy Local Security Quartet

4 Zero-Upload Scanners · 1 One-Time Bundle
DevSecOps Quartet Bundle — All 4 local CLIs & auditor packs on one-time Polar licenses · oriancy.com