Skip to content

Conversation

@wdconinc
Copy link
Contributor

@wdconinc wdconinc commented Dec 2, 2025

Briefly, what does this PR introduce?

Set workflow-level permissions to 'contents: read' (minimum) and grant additional permissions only to jobs that need them:

  • clang-tidy-iwyu: contents: write, pull-requests: write (for creating IWYU fix PRs and posting comments)
  • llvm-cov: statuses: write (for posting code coverage commit statuses)
  • trigger-container: statuses: write (for posting GitLab CI status)
  • deploy-docs: pages: write, id-token: write, pull-requests: write (for deploying GitHub Pages and posting comments)

This addresses code scanning security alert about overly permissive workflow permissions by applying the principle of least privilege.

Fixes: Various GitHub Code Scanning Alerts, https://github.com/eic/EICrecon/security/code-scanning

What kind of change does this PR introduce?

  • Bug fix (issue: permissive securi)
  • New feature (issue #__)
  • Documentation update
  • Other: __

Please check if this PR fulfills the following:

  • Tests for the changes have been added
  • Documentation has been added / updated
  • Changes have been communicated to collaborators

Does this PR introduce breaking changes? What changes might users need to make to their code?

No.

Does this PR change default behavior?

No.

Set workflow-level permissions to 'contents: read' (minimum) and grant
additional permissions only to jobs that need them:

- clang-tidy-iwyu: contents: write, pull-requests: write
  (for creating IWYU fix PRs and posting comments)

- llvm-cov: statuses: write
  (for posting code coverage commit statuses)

- trigger-container: statuses: write
  (for posting GitLab CI status)

- deploy-docs: pages: write, id-token: write, pull-requests: write
  (for deploying GitHub Pages and posting comments)

This addresses code scanning security alert about overly permissive
workflow permissions by applying the principle of least privilege.

Fixes: GitHub Code Scanning Alert #21
Copilot AI review requested due to automatic review settings December 2, 2025 01:07
Copilot finished reviewing on behalf of wdconinc December 2, 2025 01:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances workflow security by implementing the principle of least privilege for GitHub Actions permissions. It restricts the default workflow permissions to read-only and grants elevated permissions only to specific jobs that require them.

  • Set workflow-level permissions to contents: read (minimum required)
  • Added granular job-level permissions for jobs that need write access
  • Included clear comments documenting why each permission is needed

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

LGTM

@wdconinc wdconinc added this pull request to the merge queue Dec 2, 2025
Merged via the queue into main with commit ab5acdd Dec 2, 2025
135 of 136 checks passed
@wdconinc wdconinc deleted the security-permissions branch December 2, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants