ci: add read-only token permissions and pin all action references to SHAs - #1269
ci: add read-only token permissions and pin all action references to SHAs#1269Alb3e3 wants to merge 1 commit into
Conversation
…SHAs All seven CI workflows lacked a top-level permissions block, so they inherited the repository default (potentially write-all). Each workflow now has `permissions: read-all` at the top level. In addition, every action reference that used a mutable version tag was pinned to its full commit SHA, eliminating the supply-chain risk from a tag being silently moved: - actions/checkout@v6 → @df4cb1c (v6.0.3) - actions/checkout@v4 → @11bd719 (v4.2.2) - actions/upload-artifact@v6 → @b7c566a (v6) - msys2/setup-msys2@v2 → @e989830 (v2) - cygwin/cygwin-install-action@master → @781ea34 - vmactions/dragonflybsd-vm@v1 → @4ba8127 - vmactions/freebsd-vm@v1 → @a6de934 - vmactions/netbsd-vm@v1 → @99816dc - vmactions/omnios-vm@v1 → @d42d894 - vmactions/openbsd-vm@v1 → @fcf799d - vmactions/solaris-vm@v1 → @d30dd6c - google/oss-fuzz/.../build_fuzzers@master → @439b356 - google/oss-fuzz/.../run_fuzzers@master → @439b356 Verified with zizmor --min-severity medium: 0 high-severity findings after this patch (down from 26 before). Signed-off-by: Alb3e3 <tomaska.filip@gmail.com>
6efdf3b to
3927279
Compare
|
Pinning to specific commit SHA is a no-go and doesn't magically fix all potential security issues in third-party actions. Most security-related bots actually prefer to pinning to major version tag instead as it will get any new security updates as soon as they are released and if the action is no longer properly maintained, it can be tagged as such. Only Python allows setting minimum (and maximum) version for dependencies thus avoiding both breaking changes and known vulnerable or broken releases. |
|
@mtl1979 Sorry for the slow reply, and thank you — that is a fair objection and I am not going to argue it. Pinning does freeze known-vulnerable action versions in place unless something updates them, and without a Dependabot config in this repo to do that, the pins would just rot. Closing this in favour of #1295, which drops the SHA pinning entirely and only adds the #1295 touches the same seven workflow files, so the two would have conflicted anyway. |
Summary
All seven CI workflows lacked a top-level
permissions:block, so eachrun inherited the repository default, which can be write-all on permissive
settings. Every workflow now has
permissions: read-allat the toplevel, restricting the GITHUB_TOKEN to the minimum required for build and
test jobs.
In addition, every action reference that used a mutable version tag was
pinned to its full commit SHA. A tag can be silently moved; a SHA
cannot.
Actions pinned
Verification
Result: 0 high-severity findings after this patch (down from 26).
The remaining 3 medium findings are style warnings about
read-allbeingbroader than individual per-permission declarations — they are not a
regression and reflect the same posture as adding
permissions: read-allto any workflow.