Lock GitHub Actions dependencies to SHAs for security and predictability#6332
Conversation
Locking to SHAs is best practice for security and predictability as we know exactly which version is being used. Without locking to SHAs, Actions will simply use whatever latest version is available for the given specified version, usually a major such as "v4", leading to "silent bumps" at the runtime level of sorts. Locking to SHAs will also allow us to receive patch and minor level dependency upgrade PRs as opposed to, in most cases, just bumps for major versions.
|
So basically the end result is more work for us to merge PRs for minor version changes? |
I think dependabot is able to handle the pinned versions without issue. It also supports updating the version comments. Update: Ah yeah, minor version upgrades would likely be some extra work. Maybe we could tune dependabot to only update weekly or monthly if the updates were too frequent. |
|
I don't know how often these things change - you'd think they'd be fairly stable but the version numbers suggest otherwise ;-) What I do know is that there's little you can do to evaluate a pull request other than shrug your shoulders and click merge. |
For sure it will result in more PRs but I don't think it would be a ton. Can certainly tune the Dependabot config if it turns out to be a large burden. For reference regarding update frequency per action:
Overall I think most won't result it much in terms of bumps other than |
|
I see the PR that @Firefishy pointed at says GitHub recommend this... Does anybody have a pointer to that? I'm sure we probably should do it but the ugliness makes me sad 😞 |
|
To be clear, SHA pinning GitHub Actions dependencies is considered a best practice because someone could:
ℹ️ I'll admit that given this repo is only using official GitHub, Ruby, and Coveralls GitHub Actions dependencies the risk of the above happening is rather low compared to if we were using an action from an arbitrary GitHub account but the risk still exists. |
|
But we don't release anything through GH actions, do we? A malicious party could break our CI but they can do that by taking down their actions. I'm not sure what we're trying to protect against. I know supply chain attacks are real, but what's the impact beyond CI? |
|
I understand the logic of pinning, but when dependabot opens a PR to update the pin to a new version how am I supposed to evaluate if that is a genuine version or a bugged/infected/malicious version? Without that it just becomes me manually doing what happens automatically now... |
|
Like I said, it's highly unlikely anything actually malicious will occur since 1. all the actions in use are official ones and 2. the actions are only used for CI and PR utility. The inspiration behind this is that it's a best practice for security and predictability.
When a Dependabot PR appears one can read the README and if desired can click in and see the diff between the previous tag/commit and new tag/commit. This change at least allows us a chance to actually see what's changing in the GitHub Actions dependencies we use. Without it the underlying dependencies are just changing (excluding major version bumps) whenever a new version is released without any review. |
|
OK let's give it a go and see how we get on... |
Description
Lock GitHub Actions dependencies to specific version SHAs for security and predictability. Doing so is a best practice as we then know exactly which version of a given dependency is being used. Without locking to SHAs, Actions will simply use whatever latest version is available for the given specified version, usually a major such as "v4", leading to "silent bumps" at the GitHub Action runtime level.
Locking to SHAs will also allow us to receive patch and minor level dependency upgrade PRs as opposed to, in most cases, just bumps for major versions.
How has this been tested?
CI and Danger runs will prove if these changes are proper or not as they only affect GitHub Actions.
For reference here are the GitHub Actions dependencies releases so we can check the SHAs.