Skip to content

ci: declare workflow-scope permissions on attach-release-artifacts and sonarcloud#798

Open
arpitjain099 wants to merge 1 commit into
adobe:mainfrom
arpitjain099:chore/release-and-sonar-permissions
Open

ci: declare workflow-scope permissions on attach-release-artifacts and sonarcloud#798
arpitjain099 wants to merge 1 commit into
adobe:mainfrom
arpitjain099:chore/release-and-sonar-permissions

Conversation

@arpitjain099

Copy link
Copy Markdown

Two workflows currently leave the workflow GITHUB_TOKEN scope implicit. This patch pins each to its minimum:

  • .github/workflows/attach-release-artifacts.yml -- contents: write. The job packages a cursor-rules zip and uploads it via gh release upload --clobber, which hits the releases/assets API; that needs contents: write.
  • .github/workflows/sonarcloud.yml -- contents: read. The single job checks out, runs yarn lint/yarn test, then SonarSource/sonarqube-scan-action. SonarCloud authenticates via SONAR_TOKEN; the workflow GITHUB_TOKEN is only used for the implicit checkout.

Style matches the workflow-level permissions blocks already declared by publish-library.yml, publish-s2-library.yml, publish-prod-storybook.yml, publish-s2-storybook.yml, and pr-checks.yml (all using a mix of id-token: write, contents: write, pull-requests: write depending on what they actually do).

Third-party action exposure that motivates pinning: SonarSource/sonarqube-scan-action@master, actions/setup-node, actions/checkout. Explicit scope keeps a hypothetical compromise (cf. tj-actions/changed-files CVE-2025-30066) contained.

No behavioural change to either workflow.

…d sonarcloud

attach-release-artifacts uses `gh release upload` with GITHUB_TOKEN to
attach a packaged cursor-rules zip to the published release; the
release/upload-asset API call requires contents:write.

sonarcloud runs SonarSource/sonarqube-scan-action against the main
branch. The action only reads the repo + sends results to SonarCloud
via SONAR_TOKEN. contents:read covers the actions/checkout call; no
GitHub API write is needed for the scan itself.

Style matches the workflow-level permissions block already in
publish-library.yml, publish-s2-library.yml, publish-prod-storybook.yml,
publish-s2-storybook.yml, and pr-checks.yml.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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.

1 participant