Skip to content

ci: declare workflow-scope permissions on pr, pr-prod-build, add-to-project#5153

Merged
traefiker merged 1 commit into
traefik:masterfrom
arpitjain099:chore/pr-and-add-to-project-permissions
Jun 5, 2026
Merged

ci: declare workflow-scope permissions on pr, pr-prod-build, add-to-project#5153
traefiker merged 1 commit into
traefik:masterfrom
arpitjain099:chore/pr-and-add-to-project-permissions

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

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

  • .github/workflows/add-to-project.yaml -- permissions: {} (empty/deny-all). The job only runs actions/add-to-project with the TRAEFIKINFRA_ADD2PROJECT PAT; the implicit workflow token is unused.
  • .github/workflows/pr.yaml -- permissions: contents: read. Lint + test + build via yarn. No GitHub API write.
  • .github/workflows/pr-prod-build.yaml -- permissions: contents: read. Same shape as pr.yaml but for the production build path.

Both build workflows invoke SHA-pinned third-party actions (actions/checkout, actions/setup-node) and download safe-chain from a release with hash verification. Pinning the workflow scope to read narrows the blast radius if any of those upstreams is compromised (cf. tj-actions/changed-files CVE-2025-30066).

Style matches the existing workflow-level permissions: blocks in main.yaml (Pages deploy), pr_title.yaml (pull-requests: read), and release.yaml (publish).

renovate.yaml is deliberately out of scope: it uses dawidd6/action-download-artifact@v20 to restore an artifact across runs and actions/upload-artifact@v7 to publish a fresh one. The cache plumbing there deserves a more careful permissions story than a drive-by.

@darkweaver87 darkweaver87 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mdeliatf mdeliatf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution!

@mdeliatf mdeliatf closed this Jun 4, 2026
@mdeliatf mdeliatf reopened this Jun 4, 2026
@mdeliatf

mdeliatf commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Hi @arpitjain099 thanks again for this! It's got a conflict now; master merged 5b76a50 ci: remove add-to-project workflow, which deleted one of the files this PR touches, since it was blocking your PR.

Mind rebasing onto the latest master? Thanks! 🙏

@arpitjain099

Copy link
Copy Markdown
Contributor Author

Hi @arpitjain099 thanks again for this! It's got a conflict now; master merged 5b76a50 ci: remove add-to-project workflow, which deleted one of the files this PR touches, since it was blocking your PR.

Mind rebasing onto the latest master? Thanks! 🙏

@mdeliatf let me check

Add an explicit top-level permissions: contents: read block to the pr and pr-prod-build workflows so the GITHUB_TOKEN is least-privilege by default instead of inheriting the repository-wide read/write default. This follows the GitHub-hardening guidance also captured by OpenSSF Scorecard's Token-Permissions check.

Rebased onto latest master: dropped the add-to-project.yaml change since that workflow was removed upstream in 5b76a50.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@arpitjain099 arpitjain099 force-pushed the chore/pr-and-add-to-project-permissions branch from 9a8d7e2 to 6c4aeca Compare June 5, 2026 01:05
@mdeliatf mdeliatf added area/infrastructure Pull requests that update infra/dependencies status/3-needs-merge labels Jun 5, 2026
@traefiker traefiker merged commit 956e4fb into traefik:master Jun 5, 2026
4 checks passed
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 12.3.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infrastructure Pull requests that update infra/dependencies released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants