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

Reference actions by commit SHA #5266

Closed
gabibguti opened this issue Jun 2, 2023 · 3 comments · Fixed by #5269
Closed

Reference actions by commit SHA #5266

gabibguti opened this issue Jun 2, 2023 · 3 comments · Fixed by #5269
Labels
Milestone

Comments

@gabibguti
Copy link
Contributor

Description

Referencing actions by commit SHA in GitHub workflows guarantees you are using an immutable version. Actions referenced by tags and branches are vulnerable to attacks, such as the tag being moved to a malicious commit, a malicious commit being pushed to the branch or typosquatting.

Although there are pros and cons for each reference, GitHub understands using commit SHAs is more reliable, as does Scorecard security tool.

Analyzing node.js.yml and codeql-analysis.yml, the workflows use actions such as actions/checkout@v3 and actions/cache@v3. All actions are referenced by tags. To prevent the attacks mentioned above, it would be good to change the tag references to commit SHAs. If you agree, I can open a PR.

Additional Context

Hi! I'm Gabriela and I work on behalf of Google and the OpenSSF suggesting supply-chain security changes :)

@mgol
Copy link
Member

mgol commented Jun 2, 2023

Thanks for the report!

The suggestions make sense to me. The only problem is maintenance. Currently we know which major versions of the actions we're using, it won't be that clear with hashes - although, we can perhaps encode that info in comments.

We also have a dependabot config that submits PRs with action updates once a month: https://github.com/jquery/jquery/blob/main/.github/dependabot.yml. Is there a way to have that still working or do we have to take on these periodic updates by ourselves?

@mgol mgol added Build Discuss in Meeting Reserved for Issues and PRs that anyone would like to discuss in the weekly meeting. labels Jun 2, 2023
@gabibguti
Copy link
Contributor Author

Hi @mgol ! I agree with the maintenance problem. I usually recommend that you keep a comment with the semantic version after the hash, such as actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2. This way the version keeps readable. Also, dependabot is able to update the hash and the comment in GitHub actions, as you can see here, and no changes would be necessary to your dependabot.yml settings file.

@mgol
Copy link
Member

mgol commented Jun 2, 2023

That's great to hear! I don't see any blockers to the change then. 🙂

@timmywil timmywil removed the Discuss in Meeting Reserved for Issues and PRs that anyone would like to discuss in the weekly meeting. label Jun 12, 2023
@mgol mgol added this to the 3.7.1 milestone Jun 13, 2023
mgol pushed a commit that referenced this issue Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants