Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden GitHub workflows by hash-pinning Actions #6814

Closed
pnacht opened this issue Nov 21, 2023 · 0 comments · Fixed by #6815
Closed

Harden GitHub workflows by hash-pinning Actions #6814

pnacht opened this issue Nov 21, 2023 · 0 comments · Fixed by #6815
Labels
Type: Feature New features or improvements in behavior

Comments

@pnacht
Copy link
Contributor

pnacht commented Nov 21, 2023

Use case(s) - what problem will this feature solve?

When developing with GitHub workflows, it's common to version-pin dependencies (i.e. actions/checkout@v4). However, version tags are mutable, so a malicious attacker could overwrite a version tag to point to a malicious or vulnerable commit instead.

Given the extended permissions given to many workflow jobs (especially pull-requests: write),

Proposed Solution

I suggest all Actions be hash-pinned (i.e. actions/checkout@1a2b3c... # v4.0.0) to a specific commit instead of major-version-pinned. Pinning workflow dependencies by hash ensures the dependency is immutable and its behavior is guaranteed.

These hashes can be automatically updated by dependabot. Dependabot can periodically send a single PR to update the hashes for all Actions with new versions (see this example PR).

I'll send a PR pinning the Actions and setting up dependabot along with this issue.

Additional Context

My name is Pedro and I work with Google and the OpenSSF to improve the supply-chain security of the open-source ecosystem.

@pnacht pnacht added the Type: Feature New features or improvements in behavior label Nov 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant