-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Why
A bad actor can force push a tag so that GitHub Action to do some malicious actions.
A bad actor can push a malicious container image under the same name.
What
We should use digest pinning to mitigate the possibility of using a malicious GitHub Actions and container images.
It should also make the build more reproducible.
Some references:
- https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions
- https://candrews.integralblue.com/2023/09/always-use-docker-image-digests/
When using GitHub Actions we can add a comment with a after the digest (e.g. actions/checkout@01aecccf739ca6ff86c0539fbc67a7a5007bbc81 # v2.1.0).
Both Renovate and Dependabot can bump both the digest and the tag in the comment:
- For actions that are pinned-by-hash, bump the human readable version number in the code comment dependabot/dependabot-core#4691 (comment)
- https://docs.renovatebot.com/modules/manager/github-actions/
When using container images we can add the digest at the end (e.g. node:14.15.1@sha256:d938c1761e3afbae9242848ffbb95b9cc1cb0a24d889f8bd955204d347a7266e).
Both Renovate and Dependabot can bump the image name and the digest as well: