-
Notifications
You must be signed in to change notification settings - Fork 191
Pin GitHub Actions to SHA and add enforcement #4584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT | ||
|
|
||
| go 1.25.3 | ||
|
|
||
| require github.com/suzuki-shunsuke/pinact v1.6.0 // cmd/pinact |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= | ||
| github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= | ||
| github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
| github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
| github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||
| github.com/google/go-github/v70 v70.0.0 h1:/tqCp5KPrcvqCc7vIvYyFYTiCGrYvaWoYMGHSQbo55o= | ||
| github.com/google/go-github/v70 v70.0.0/go.mod h1:xBUZgo8MI3lUL/hwxl3hlceJW1U8MVnXP3zUyI+rhQY= | ||
| github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= | ||
| github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= | ||
| github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= | ||
| github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= | ||
| github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= | ||
| github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= | ||
| github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= | ||
| github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= | ||
| github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
| github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= | ||
| github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= | ||
| github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= | ||
| github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= | ||
| github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA= | ||
| github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo= | ||
| github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
| github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
| github.com/suzuki-shunsuke/logrus-error v0.1.4 h1:nWo98uba1fANHdZ9Y5pJ2RKs/PpVjrLzRp5m+mRb9KE= | ||
| github.com/suzuki-shunsuke/logrus-error v0.1.4/go.mod h1:WsVvvw6SKSt08/fB2qbnsKIMJA4K1MYCUprqsBJbMiM= | ||
| github.com/suzuki-shunsuke/pinact v1.6.0 h1:2QvSzREOquwLwKXhF9Hj0AInE/Rl63SZz9dKkHFC6so= | ||
| github.com/suzuki-shunsuke/pinact v1.6.0/go.mod h1:FDUMck0mmL0mcnNZ23Vjh/aOR5cIdZhF1IIpGksT4dQ= | ||
| github.com/suzuki-shunsuke/urfave-cli-help-all v0.0.4 h1:YGHgrVjGTYHY98II6zijXUHP+OyvrzSCvd8m9iUcaK8= | ||
| github.com/suzuki-shunsuke/urfave-cli-help-all v0.0.4/go.mod h1:sSi6xaUaHfaqu32ECLeyE7NTMv+ZM5dW0JikhllaalY= | ||
| github.com/urfave/cli/v2 v2.27.6 h1:VdRdS98FNhKZ8/Az8B7MTyGQmpIr36O1EHybx/LaZ4g= | ||
| github.com/urfave/cli/v2 v2.27.6/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= | ||
| github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= | ||
| github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= | ||
| golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc= | ||
| golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= | ||
| golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||
| golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||
| golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= | ||
| golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||
| golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= | ||
| golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= | ||
| golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
| gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||
| gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
| gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,3 +36,5 @@ GOVULNCHECK="${GOBIN}/govulncheck-v1.1.4" | |
|
|
||
| MOCKGEN="${GOBIN}/mockgen-v0.6.0" | ||
|
|
||
| PINACT="${GOBIN}/pinact-v1.6.0" | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Ensure SHA Pinned Actions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - master | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - '.github/workflows/**' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - '.github/workflows/**' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ensure-sha-pinned-actions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Ensure SHA Pinned Actions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Harden Runner | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| egress-policy: audit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Ensure SHA pinned actions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: zgosalvez/github-actions-ensure-sha-pinned-actions@6124774845927d14c601359ab8138699fa5b70c3 # v4.0.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering that security is the goal of the pull request, has this GH Action been vetted? Does it need to be vetted?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Click to expand outdated comment about a different toolSure, you're right to ask and indeed I've already done an inspection. So here's a formal report from my findings. Security Report: mheap/pin-github-actionSHA: Summary
Dependencies (package.json)
All dependencies are mainstream, well-maintained packages. Security Scanning Results
Your Mitigations (Already Applied)
Gaps to Address
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it looks like you reported on
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sorry I got confused with one of the alternatives I was considering. These tools are complementary, not alternatives:
Summary
┌─────────────────┬─────────────────────────────────────────┬────────────────────────────────────────────────────┐
│ Aspect │ mheap/pin-github-action │ zgosalvez/github-actions-ensure-sha-pinned-actions │
├─────────────────┼─────────────────────────────────────────┼────────────────────────────────────────────────────┤
│ Primary Purpose │ CLI tool to pin actions to SHAs │ GitHub Action to validate actions are pinned │
├─────────────────┼─────────────────────────────────────────┼────────────────────────────────────────────────────┤
│ Use Case │ Developer workflow / one-time migration │ CI enforcement / ongoing validation │
├─────────────────┼─────────────────────────────────────────┼────────────────────────────────────────────────────┤
│ Recommendation │ ✅ Use for initial pinning │ ✅ Use for CI enforcement │
└─────────────────┴─────────────────────────────────────────┴────────────────────────────────────────────────────┘
1.2 Repository Health
┌────────────────┬─────────────────────────┬────────────────────────────────────────────────────┐
│ Metric │ mheap/pin-github-action │ zgosalvez/github-actions-ensure-sha-pinned-actions │
├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
│ Stars │ 141 │ 48 │
├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
│ Forks │ 17 │ 16 │
├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
│ Contributors │ 10 │ 8 │
├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
│ Open Issues │ 19 │ 7 │
├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
│ License │ MIT │ MIT │
├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
│ Latest Release │ v3.4.0 (2025-06-22) │ v4.0.1 (2025-12-13) │
├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
│ Last Push │ 2025-06-22 │ 2026-01-31 │
├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
│ Archived │ No │ No │
└────────────────┴─────────────────────────┴────────────────────────────────────────────────────┘
Both projects are actively maintained. The zgosalvez action has more recent activity.
2. Security Analysis
2.1 zgosalvez/github-actions-ensure-sha-pinned-actions
Strengths:
┌──────────────────────────┬─────────────────────────────────────────────────────────────────────┐
│ Aspect │ Assessment │
├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
│ Minimal permissions │ No special permissions required; read-only operation │
├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
│ Native GitHub Action │ Runs in isolated runner environment │
├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
│ Node24 runtime │ Modern, supported Node.js version │
├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
│ Small dependency surface │ Only 3 runtime deps: @actions/core, @actions/glob, yaml │
├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
│ Bundled distribution │ Uses @vercel/ncc to bundle dependencies (reduces supply chain risk) │
├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
│ Allowlist support │ Can exempt trusted publishers (e.g., actions/*) │
├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
│ Dry-run mode │ Non-blocking validation option │
└──────────────────────────┴─────────────────────────────────────────────────────────────────────┘
Concerns:
┌─────────────────────────────────┬──────────┬────────────────────────────────────────────┐
│ Concern │ Severity │ Mitigation │
├─────────────────────────────────┼──────────┼────────────────────────────────────────────┤
│ Single maintainer (zgosalvez) │ Low │ MIT license allows forking; PR pins to SHA │
├─────────────────────────────────┼──────────┼────────────────────────────────────────────┤
│ Reports only first error │ Low │ Multiple CI runs will surface all issues │
├─────────────────────────────────┼──────────┼────────────────────────────────────────────┤
│ Allowlist misconfiguration risk │ Low │ Review allowlist in PR reviews │
└─────────────────────────────────┴──────────┴────────────────────────────────────────────┘
Dependencies (v4.0.1):
@actions/core@1.11.1 - Official GitHub toolkit (trusted)
@actions/glob@0.5.0 - Official GitHub toolkit (trusted)
yaml@2.8.2 - Well-maintained YAML parserI think it is safe to proceed. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering that security is the goal of the pull request, has this GH Action been vetted? Does it need to be vetted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security Report: step-security/harden-runner
SHA:
e3f713f2d8f53843e71c69a996d56f51aa9adfb9(v2.14.1)Summary
OpenSSF Scorecard (v5.0.0) — Score: 8.5/10
SHA Verification
e3f713f2d8f53843e71c69a996d56f51aa9adfb9e3f713f2d8f53843e71c69a996d56f51aa9adfb9Organization Profile
Recommendation
✅ Approved for use
This is a professional security tool from a verified security company with: