Skip to content

Reduce backport workflow token permissions - #890

Merged
wenju-he merged 2 commits into
intel:mainfrom
wenju-he:fix-backport-token-permissions
Oct 8, 2026
Merged

wenju-he merged 2 commits into
intel:mainfrom
wenju-he:fix-backport-token-permissions

Conversation

@wenju-he

@wenju-he wenju-he commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Scorecard's Token-Permissions check scores 0 for write permissions declared at workflow top level.

  • Keep only contents: read at the top level of backport-to-branch.yml and grant the write permissions on the backport job.
  • Remove the delete-backport-branch job, which needed job-level contents: write only to delete merged backport/* branches, together with the pull_request trigger it was the only consumer of. Branch cleanup is left to the repository's "Automatically delete head branches" setting.

Scorecard's Token-Permissions check scores 0 for write permissions
declared at workflow top level.

- Keep only contents: read at the top level of backport-to-branch.yml
  and grant the write permissions on the backport job.
- Remove the delete-backport-branch job, which needed job-level
  contents: write only to delete merged backport/* branches, together
  with the pull_request trigger it was the only consumer of. Branch
  cleanup is left to the repository's "Automatically delete head
  branches" setting.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@wenju-he
wenju-he enabled auto-merge (squash) October 8, 2026 00:29
@wenju-he
wenju-he requested review from cdai2 and a balanced review from Copilot October 8, 2026 00:29

Copilot AI 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.

🟢 Approval recommended

The permission scoping is valid and the removed trigger exclusively served the deleted cleanup job.

0 open findings

What changed in this PR

Restricts workflow-level token permissions while preserving the backport job’s required access.

Changes:

  • Sets top-level permissions to contents: read.
  • Moves write permissions to the backport job.
  • Removes the redundant branch-deletion job and trigger.
File Description
.github/​workflows/​backport-to-branch.yml Applies least-privilege permissions and delegates branch cleanup to repository settings.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

cdai2
cdai2 previously approved these changes Oct 8, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@wenju-he
wenju-he merged commit 2411ca9 into intel:main Oct 8, 2026
1 of 3 checks passed
@wenju-he
wenju-he deleted the fix-backport-token-permissions branch October 8, 2026 03:04
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.

3 participants