breaking: Add explicit permissions to workflows#344
Merged
carlcsaposs-canonical merged 1 commit intomainfrom Mar 31, 2026
Merged
breaking: Add explicit permissions to workflows#344carlcsaposs-canonical merged 1 commit intomainfrom
carlcsaposs-canonical merged 1 commit intomainfrom
Conversation
Contributor
Author
taurus-forever
approved these changes
Mar 15, 2026
taurus-forever
left a comment
There was a problem hiding this comment.
Thank you for adding comments for most of perms. Would be great to have a followup task to decrease perms further.
Contributor
Author
wdym? the permissions are needed for the workflows to function with the exception of |
cf1704d to
aa6238b
Compare
- Add `permissions` to reusable workflows to drop to minimal permissions, regardless of the caller repository - Update usage docs examples to call reusable workflows with minimal permissions Breaking change since `contents: read` and `actions: read` permissions were added to some workflows—it is not needed for public repositories, but is necessary for the workflows to succeed on private repositories. In order to drop to minimal permissions on the reusable workflows (e.g. so that other permission scopes are `none`) we have to set these on both public & private repositories. It might be possible to dynamically set this—but since these are read-only scopes, there is minimal additional risk—so it does not seem worth additional complexity to avoid the additional scopes for public repos only. Furthermore, for public repositories, it appears these read-only scopes do not grant additional permissions since the endpoints appear to already be available without authentication for public repositories: https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28#repository-permissions-for-contents, https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28#repository-permissions-for-actions
2f778e7 to
c0ebd05
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
permissionsto reusable workflow internal jobs to drop to minimal permissions (for GITHUB_TOKEN), regardless of permissions set by the caller repositorypermissionsfor data-platform-workflows repository internal workflows (workflows beginning with two underscores in file name)Breaking change since
contents: readandactions: readpermissions were added to some workflows (which requires caller to add those permissions)—it is not needed for public repositories, but is necessary for the workflows to succeed on private repositories. In order to drop to minimal permissions on the reusable workflows (e.g. so that other permission scopes arenone) we have to set these on both public & private repositories. It might be possible to dynamically set this—but since these are read-only scopes, there is minimal additional risk—so it does not seem worth additional complexity to avoid the additional scopes for public repos only. Furthermore, for public repositories, it appears these read-only scopes do not grant additional permissions since the endpoints appear to already be available without authentication for public repositories: https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28#repository-permissions-for-contents, https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28#repository-permissions-for-actionsMigration instructions
For each reusable workflow, check the usage docs (https://github.com/canonical/data-platform-workflows?tab=readme-ov-file#usage) and, for each workflow call, update
permissionsto match the usage docs