Sentinel · security scanner
workflow-sentinel
Catch insecure GitHub Actions workflows before they're merged.
npm i -D workflow-sentinelWhat it checks
dangerous-checkoutpull_request_target/workflow_runthat checks out the PR head (ref: ${{ github.event.pull_request.head.sha }},github.head_ref,refs/pull/…,gh pr checkout)unpinned-actionuses:with a tag or branch instead of a 40-char commit SHA (steps, reusable workflows, composite actions)broad-permissionspermissions: write-allat workflow or job level. Top-level write scopes shared by several jobs are reported as lowscript-injection${{ github.event.issue.title }},…pull_request.body,github.head_ref, comment bodies, commit messages and similar values pasted intorun:oractions/github-script.${{ inputs.* }}in composite actions is reported as mediumsecrets-untrustedSecrets used in a job that runs checked-out PR code. Echoing${{ secrets.* }}is reported as mediumself-hosted-prruns-on: self-hostedin a workflow triggered by pull requests or commentsmissing-permissionsNo top-levelpermissions:and jobs without their ownpersist-credentialsactions/checkoutwithoutpersist-credentials: false
Quick usage
CLI
npx workflow-sentinel # scan the current repository
npx workflow-sentinel .github/workflows/release.yml --fail-on medium
npx workflow-sentinel --trusted-owner actions --trusted-owner github
GH_TOKEN=... npx workflow-sentinel --fix # pin every action to its current commit SHA (# v4 comment for Dependabot)
API
import { scan, scanText, formatSarif } from 'workflow-sentinel';
const { findings } = scan({ cwd: '.', config: { trustedOwners: ['actions'] } });
Every option is documented in the workflow-sentinel docs.
CI / GitHub Action
name: Workflow security
on: [push, pull_request]
permissions:
contents: read
security-events: write
jobs:
workflow-sentinel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with: { persist-credentials: false }
- uses: MrLouisWright/workflow-sentinel@v1
with:
fail-on: high
sarif: workflow-sentinel.sarif
- if: always()
uses: github/codeql-action/upload-sarif@v3
with: { sarif_file: workflow-sentinel.sarif }