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

CI: Set minimum permissions on GitHub Workflows #764

Closed
diogoteles08 opened this issue Mar 1, 2023 · 2 comments · Fixed by #765
Closed

CI: Set minimum permissions on GitHub Workflows #764

diogoteles08 opened this issue Mar 1, 2023 · 2 comments · Fixed by #765

Comments

@diogoteles08
Copy link
Contributor

Hello!

I'd like to suggest the definition of minimal permissions on your GitHub workflows, as it would harden your security agains supply-chain attacks. I see that one of your workflows (codeql-analysis) declares job-level minimal dependencies, but the other workflows don't actually define them, and they would be set as the GitHub defaults.

The ideal is to always define top-level minimal permissions(that would be inherited by all jobs with unspecified permissions), and then use job-level permissions for any job that might need other specific permissions. In this way you would be secured against erroneous or malicious actions from external jobs you call from your workflow. It's specially important in the case they get compromised, for example.

Setting minimum permissions for workflows is recommended by GitHub itself and also by other security tools, such as Scorecards and StepSecurity.

I'd be happy to raise a PR with the changes if you agree.

Context
I'm Diogo and I work on Google's Open Source Security Team(GOSST) in cooperation with the Open Source Security Foundation (OpenSSF). My core job is to suggest and implement security changes on widely used open source projects 😊

@klauspost
Copy link
Owner

klauspost commented Mar 2, 2023

@diogoteles08 Thanks! I looked at the docs, and I think I'd be most comfortable with a PR, if you don't mind

Goreleaser recommends these permissions for their action:

permissions:
  contents: write

The rest is just standard tests.

@diogoteles08
Copy link
Contributor Author

Of course, I'll be raising the PR shortly

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 a pull request may close this issue.

2 participants