Skip to content

ci: pin workflows by hash - #1721

Merged
james-garner-canonical merged 9 commits into
canonical:mainfrom
james-garner-canonical:2025-05/ci/pin-workflows-by-hash
May 12, 2025
Merged

james-garner-canonical merged 9 commits into
canonical:mainfrom
james-garner-canonical:2025-05/ci/pin-workflows-by-hash

Conversation

@james-garner-canonical

Copy link
Copy Markdown
Contributor

This PR updates our uses of actions in our actions and workflows to specify them by their hash, rather than by tag. This is a good idea because tags are movable, and so could result in the execution of malicious code in our workflows if a bad commit is added to any of those actions.

I believe that dependabot can be configured to open PRs to bump the commit hash (and version comment) when there are new releases, though I'm not sure what will happen with our current configuration.

@tonyandrewmeyer

Copy link
Copy Markdown
Collaborator

I think with this change we can tighten the zizmor policy (perhaps even totally removing zizmor.yml to go back to the default behaviour), and perhaps even run at a stricter level. Would you be able to look into that?

@james-garner-canonical

Copy link
Copy Markdown
Contributor Author

Somehow the Python 3.8 unit tests on ubuntu failed with a runner crash, potentially a segmentation fault, so that's weird. They passed when rerunning the job.

@james-garner-canonical

james-garner-canonical commented May 8, 2025 •

Copy link
Copy Markdown
Contributor Author

I think with this change we can tighten the zizmor policy (perhaps even totally removing zizmor.yml to go back to the default behaviour), and perhaps even run at a stricter level. Would you be able to look into that?

Looks like we can indeed drop our zizmor.yml config file. The zizmor docs indicate that official actions (like those beginning actions/) can be pinned to a version tag with the default settings -- would we want to use version tags in this case, and hashes only for third party actions?

@tonyandrewmeyer

Copy link
Copy Markdown
Collaborator

Looks like we can indeed drop our zizmor.yml config file.

Nice :). I was wondering if we could switch persona (to pedantic or maybe even auditor) but it doesn't seem like it's worth it with the current rules (and might be annoying in one specific case with moving tags).

The zizmor docs indicate that official actions (like those beginning actions/) can be pinned to a version tag with the default settings -- would we want to use version tags in this case, and hashes only for third party actions?

I'd say let's go with what you have now, and if we find it annoying that we're prompted to update too often (or falling behind becomes annoying) then we could loosen it up later.

@james-garner-canonical
james-garner-canonical merged commit 177a5e9 into canonical:main May 12, 2025
james-garner-canonical added a commit that referenced this pull request May 27, 2025
This PR essentially reverts the changes made in #1721 for actions
provided by the `actions` and `github` organisations, pinning these
first-party actions by tag to reduce version bumping busywork.
Third-party actions (currently provided by `astral-sh`, `tiobe`, and
`amannn`) are still pinned by commit hash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants