-
Notifications
You must be signed in to change notification settings - Fork 1.7k
make GitHub workflow permissions explicit #1692
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
base: master
Are you sure you want to change the base?
make GitHub workflow permissions explicit #1692
Conversation
Please add more context in the description of this PR, such as links to GitHub documentation about the permissions settings in the workflow file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm all for following the principle of least privilege, why do we need packages: read?
permissions: | ||
contents: read | ||
packages: read | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this really changes the permissions from the default.
This document says that the default permissions are contents: read, packages: read
... if we are in restricted mode (but I don't know if that is the case).
But I'm not sure we even need both.
@cedricvanrompay-datadog Please fix this: #1692 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setup-go
action recommends contents: read
permission. No mention of packages: read
.
The checkout
action also recommends contents: read
permission. No mention of packages: read
.
So I don't see a reason to grant packages: read
.
Summary
make GitHub workflow permissions explicit
Changes
Add a top-level
permissions
field in each GitHub workflow file.Note that this should not lead to any changes in the permissions workflows currently have because the permissions written mirror the default permissions or are overwritten by job-level permissions
Motivation
It makes workflow permissions easier to read and understand, and it makes some scanner happy like OSSF Scorecard: https://deps.dev/project/github/stretchr%2Ftestify
Related issues
None.