Skip to content

Fix token permissions: move security-events:write to job-level (Scorecard alert #571) - #5473

Draft
Alan Jowett (Alan-Jowett) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-scanning-alert-571
Draft

Fix token permissions: move security-events:write to job-level (Scorecard alert #571)#5473
Alan Jowett (Alan-Jowett) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-scanning-alert-571

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

Scorecard flagged security-events: write set at the top-level workflow permissions in cicd-release-validation.yml (since consolidated into cicd.yml), violating least-privilege for the GITHUB_TOKEN. Write permissions at the top level apply to all jobs in the workflow, not just those that need them.

Changes:

  • cicd.yml: Remove security-events: write from top-level permissions; add it at job-level for the ossar job only (with checks: read and contents: read also scoped to that job, matching what ossar-scan.yml requires)
  • codeql.yml: Same pattern — remove from top-level, add at job-level for the codeql job that calls reusable-build.yml with build_codeql: true
  • reusable-build.yml: Add security-events: write to the workflow permissions declaration, since it uses github/codeql-action/analyze when build_codeql: true

Testing

No code changes. Existing CI workflows validate that GitHub Actions YAML is syntactically valid. No new tests needed.

  • Unit tests are added.
  • Driver tests are added.
  • Fuzz tests are added.

Documentation

No documentation impact.

Installation

No installer impact.

Copilot AI changed the title [WIP] Fix code scanning alert 571 Fix token permissions: move security-events:write to job-level (Scorecard alert #571) Jul 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

Comment on lines 23 to 27
permissions:
id-token: write # Required to log in to Azure.
contents: read
checks: read # Required by reusable-test.yml to check build status.
security-events: write # Required by codeql task.
issues: write # Required to create issues.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There's only one job, and it has its own permission block. Can we remove the workflow-level permissions block all together?

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

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants