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 minimal permissions on GitHub Workflows #7069

Closed
diogoteles08 opened this issue Sep 22, 2023 · 0 comments · Fixed by #7070
Closed

CI: Set minimal permissions on GitHub Workflows #7069

diogoteles08 opened this issue Sep 22, 2023 · 0 comments · Fixed by #7070
Labels
enhancement status:Needs Triage Applied to issues that need triage

Comments

@diogoteles08
Copy link
Contributor

Problem

I noticed that some of your GitHub Workflows don't specify their permissions (as ui-tests.yml), and others define some potentially dangerous write permissions (i.e., usually contents: write) that might not be required. It's recommended that you always define minimal permissions to your workflows, as secures you against erroneous or malicious behaviours from external jobs you call from them. It's specially important for the case they get compromised, for example, and it's a recommendation by GitHub itself and also by other security tools, such as Scorecards and StepSecurity.

Proposed Solution

I'd recommend that you review the write permissions of your workflows and substitute them by read permissions whenever possible. Ideally you would set a top-level read-only permission on all workflows, so that they would be inherited by any job that does not define job-level permissions. For any job that requires write permissions, they can be defined locally as job-level permissions.

As those would be changes of few lines of code, I'll take the liberty to send a PR setting the required minimal permissions as I understand by the workflows. Then you can evaluate the suggestion more easily and correct me where I'm mistaken.

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 😊

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement status:Needs Triage Applied to issues that need triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant