The advice here is really great (as I'd expect from Hugo), but as the maintainer of zizmor I want to note some caveats with the current iteration of workflow lockfiles:<p>- They only lock normal action calls. If your workflows invoke other reusable workflows, you need to keep those hash-pinned manually for now.<p>- Composite actions are not <i>themselves</i> locked. Instead, they get locked transitively through their callsites i.e. the workflows that call them. This makes any individual caller that uses lockfiles safe, but it also makes the current `gh actions-lock` default <i>unsafe</i> (since it removes hash-pins from the composite action itself, meaning that any external caller that invokes the action loses their transitive pinning).<p>- Other forms of `uses:` clauses, like Docker images, are also not currently locked via the lockfile. And the same for forms of interior mutability (like an action running `npx ...` under the hood, although the latter is fully outside of GitHub's control to prevent. But these mean that you <i>can't</i> assume that a fully locked Actions setup is in fact 100% immutable.<p>I hope they address these gaps soon, because it's otherwise an excellent (and long-awaited) feature.
Quoting someone else's blog I've forgotten but you're trading the trust in the repo owner not moving a tag for trusting whoever merges the commit hash to have checked that's a release in the repo you want and not _some_ forks commit. All forks on github are the same repo you can pin any commit, merged upstream or not.<p>IMO Github should make Immutable tags mandatory to publish on <a href="https://github.com/marketplace" rel="nofollow">https://github.com/marketplace</a>
Why not make the marketplace published tags immutable instead like others do?
Actions lockfiles prevent this. They won't allow you to lock an impostor commit, which is the right default.<p>(The previous way to provide general actions immutability, i.e. hash-pinning, had this issue and thus required additional checks.)
That’s exactly what lockfiles are intended to avoid!
One could write an action that executes a shell script that does docker pull abc:latest.<p>As the consumer of an action that becomes really hard to find out unless I take the whole codebase apart.
I almost forgot about that completely outrageous treatment of forks -- just bonkers.
I think my main advice is to avoid GH actions at all, unless avoiding them is somehow painful. There is just a long bad history here.
These days setting up a proper system on your build orchestrator of choice is pretty easy, cheaper, and you basically only lose a tiny bit of UI niceness if they report to github anyway
What would you suggest instead?
Just about anything else, tbh. Jenkins is the option I would go for, but that’s a reflection of my personal preferences for self-hosting. Self-hosting has gotten way easier since LLMs can debug things so well, so I’m self-hosting more than ever before even though I have less time available.<p>You don’t have to go Jenkins, it’s just that GitHub Actions are uniquely bad and I would avoid them.<p>If you are relying on the free version of GitHub actions for small projects, I would consider just running something on a NUC or Pi at home.
The whole system is just bad. Even Jenkins is better. Or a shell script in a one minute cronjob.
I undrrstand this looks cleaner and more intuitive, but you still have the risk of running a workflow with malicious/compromised actions, like manually, or locally with act, if you do not verify the lockfile as part of the workflow or preceded by an extra workflow step. This should be something that the runner ideally should handle (as part of the platform). This still is a workaround, just like the sha pinning. I only use vendor upstream actions, like github's or forks in our own org.
Are people finding a real need for importing and updating git actions? Aren't they usually just running a one line bash command? I'd just copy paste the action in to your config so it's fully locked and under your control rather than importing some opaque script from a no name github user.
Github actions are not that simple. Not even close
A lot of things that <i>should</i> be one bash command turn out to be dozens of lines of incantations and handling edge cases. Microsoft I'm looking in your direction.<p>For those things an action helps.
Are there clear reasons to prefer this over just pinning a commit SHA?
You can keep the information provided by the version number, and if the maintainer is using real SemVer, it's easier to upgrade.
Presumably it’s for the transitive dependencies. You pin action X, but that (third party) action doesn’t correctly pin the SHA of action Y, so you still get owned if the mutable tag gets moved to a compromised commit.<p>But with a lockfile, direct and indirect dependencies both get pinned. (I presume, and haven’t checked yet, but otherwise this feature would be useless)
big fan of actions-up for doing this: <a href="https://github.com/azat-io/actions-up" rel="nofollow">https://github.com/azat-io/actions-up</a>
Does this prevent one of the locked dependencies not locking their own dependencies and pulling in a malicious and replaced tag?
It does not. Obviously if you lock a “foo/setup-latest-go” action, it’s still going to (and you’d probably expect it to) pull in the latest go. Actions are expected to start running though. Like GitHub isn’t gonna do an `npm install` for you, it’ll just run the entry point of the action, and the entry point can do whatever it was written to do.
I remember reading (but haven’t verified) that even using a specific SHA instead of a tag isn’t a guarantee with GitHub Actions, because the Action itself may have a dependency which does not pin to a SHA, thus making you vulnerable all the same. This lock file strategy does not appear to guard agains that, it seems to be what we had before but trades a bit more readability in one file for an extra (more complex) lock file. Not a trade-off I want to make (but you do you).<p>Personally I found the risk of running someone else’s GitHub Action in my repo to not be worth it. Even GitHub’s own Action to checkout repos is <i>way</i> more complex than I need it to be and last I checked had dependencies which could be targeted. I opt instead to not run any third-party Actions (not even GitHub’s official ones) in my repos.
at this point im seriously pondering how to build a dvcs code forge thats not dog shit, versions its own state, and actually is semantically grounded rather than a rails app gone awry
So "SHA pinning with version reference in a comment" with extra steps, got it
Yes, I scratched my head trying to understand what this accomplishes. It just puts a tag back instead of a SHA but now moves the SHA (locked in) to a separate file that now needs to be verified ?
I fail to see how this is better or needed.
SHA pinning on GitHub does not always imply account pinning, even where the account name is explicitly specified along with it.<p>So some of the extra steps are meaningful. Though I am still not convinced they could not have been implemented in a deliberately backwards-incompatible way to Github action in general, keeping the syntax and removing only the special case that is never both intentional and non-malicious at the same time.
Enforced through GitHub Actions that is :)
If GitHub really cared about security they could fix this tomorrow by declaring any tag linked to an action immutable.<p>They don't because they don't.<p>Anybody who's ever moved a git tag knows the ergonomics of doing so are so awful that you're obviously not supposed to be doing it.
[flagged]
[flagged]
[flagged]
Shouldn’t we all just be vibe coding our own actions instead of using the marketplace ones? Is SaaS dead yet, or what?<p>/s<p>This is a step in the right direction, but it’s not even close to a complete solution. And what am I doing installing a plugin to use this? It should just be part of GH, so I can install that and not have yet another source of dependency management to lock down.
[dead]
So instead of specifying a SHA1 hash of <i>some</i> commit and change it rarely enough to just check manually, now every developer needs to unsafe-eval some 476 transitive dependencies of the helper that fixes the lockfile? I wonder at which point it gets easier to just have a nice stdlib again, and not deal with tons and tons of version changes in packages across 3 different language ecosystems.
ctrl + f "zizmor"
8 found<p>I endose this article.