Skip to content

ci: declare contents:read on publish workflow#9442

Merged
JakeWharton merged 1 commit into
square:masterfrom
arpitjain099:chore/publish-permissions
May 15, 2026
Merged

ci: declare contents:read on publish workflow#9442
JakeWharton merged 1 commit into
square:masterfrom
arpitjain099:chore/publish-permissions

Conversation

@arpitjain099
Copy link
Copy Markdown
Contributor

The publish workflow runs on tag push and invokes ./gradlew publish. The actual authentication for Maven Central + GPG signing flows through ORG_GRADLE_PROJECT_* secrets (SONATYPE_CENTRAL_USERNAME, SONATYPE_CENTRAL_PASSWORD, GPG_SECRET_KEY, GPG_SECRET_PASSPHRASE), not the workflow GITHUB_TOKEN. There's no other GitHub API call beyond actions/checkout.

This patch adds permissions: contents: read at workflow scope, matching the workflow-level block already used in build.yml and the per-job blocks in containers.yml and docs.yml. With it set:

  • the workflow token can't be widened by a future change to the repository default
  • the SLSA / OpenSSF Scorecard Token-Permissions check goes green for this file
  • if actions/setup-java or 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 secrets

No behavioural change.

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 <[email protected]>
@JakeWharton JakeWharton merged commit 1d9a8ba into square:master May 15, 2026
44 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants