-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support specifying the default permissions for a GitHub Action token #36
Comments
In GitLab by @netomi on May 12, 2023, 06:52 Ty for your report though I am not sure to what workflow you refer to. There we specify the permissions for the GITHUB ACTION token: content: read |
In GitLab by @sschrock on May 12, 2023, 07:55 Ah sorry for any confusion. This wasn't relating to any workflow in particular. I just didn't see "workflow permissions" as a supported org/repo setting on the README. I attended the OtterDog talk at OSS NA which talked about configuring branch protection, and thought it would be a setting that OtterDog could use when configuring orgs or repos.
I can give an example though. Take this GitHub workflow under the eclipse foundation: As it doesn't specify any permissions, the If the org/repo was instead configured with the restricted default permissions, this sort of over privileged token could be prevented. Although in this case the workflow would need to have the Of course, the |
In GitLab by @netomi on May 12, 2023, 08:09 Ah now I understand, you refer to these settings: They exist on organization and repo level. Unfortunately, they are not accessible via any programmatic API so far, so otterdog would have to access it via the web UI (which it already does for some other settings). It makes certainly sense, will work on that. Ty for the report! |
In GitLab by @netomi on May 12, 2023, 10:16 Added support for a new setting 'default_workflow_permissions' on organization level which can either be 'read' or 'write'. We dont use the web ui yet for repo level settings as this would make the tool rather slow when you have lots of repos in your organization. For now I would omit the very same setting on repo level, if you specify e.g. read on org level you can not be more permissive on repo level anyway. The default should be read on org level and then enable for each workflow individually if it requires more permissions. |
In GitLab by @sschrock on May 12, 2023, 03:44
By default, the
GITHUB_TOKEN
present in a GitHub Action workflow is overly permissive and contain write access to repository contents and releases. This presents a risk as developers may not realize the token they're passing to a linter could be used to modify the repository.GitHub supports restricting the default
GITHUB_TOKEN
permissions at the enterprise/org/repo level.https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
OtterDog would benefit from adding support for this setting, and considering restricted permissions as a secure default. This setting provides a quick win for repository security without needing to change every workflows. Note: some workflows may need to add permissions which were previously granted by default, but this follows least privilege.
The text was updated successfully, but these errors were encountered: