ci: declare contents:read on publish workflow#9442
Merged
JakeWharton merged 1 commit intoMay 15, 2026
Conversation
publish.yml runs `./gradlew publish` against Maven Central with Sonatype + GPG credentials passed via secrets. The workflow's own GITHUB_TOKEN isn't used by Gradle for the publish, so contents:read is the minimum. Matches the workflow-level permissions block already used in build.yml and the per-job blocks in containers.yml / docs.yml. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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.
The
publishworkflow runs on tag push and invokes./gradlew publish. The actual authentication for Maven Central + GPG signing flows throughORG_GRADLE_PROJECT_*secrets (SONATYPE_CENTRAL_USERNAME,SONATYPE_CENTRAL_PASSWORD,GPG_SECRET_KEY,GPG_SECRET_PASSPHRASE), not the workflowGITHUB_TOKEN. There's no other GitHub API call beyondactions/checkout.This patch adds
permissions: contents: readat workflow scope, matching the workflow-level block already used inbuild.ymland the per-job blocks incontainers.ymlanddocs.yml. With it set:Token-Permissionscheck goes green for this fileactions/setup-javaor any other third-party dependency reachable from this workflow is ever compromised (cf. tj-actions/changed-files CVE-2025-30066), the explicit read-only scope keeps it boxed away from the publish secretsNo behavioural change.