Skip to content

Add explicit permissions to settings.yml workflow (alert #3) - #26

Merged
antgrutta merged 2 commits into
mainfrom
copilot/fix-code-scanning-alerts-3
May 13, 2026
Merged

Add explicit permissions to settings.yml workflow (alert #3)#26
antgrutta merged 2 commits into
mainfrom
copilot/fix-code-scanning-alerts-3

Conversation

Copilot AI commented May 13, 2026

Copy link
Copy Markdown
Contributor

Bug Fix

What was the bug?

The configure_repo job in .github/workflows/settings.yml had no permissions block, leaving GITHUB_TOKEN scope governed by repo/org defaults — which may be read-write and violate least-privilege (CodeQL actions/missing-workflow-permissions, CWE-275).

How did you fix it?

Added permissions: contents: read at the job level. The two privileged steps (Setup Custom Properties, Setup Repository Variables) already use a dedicated ISSUE_SUBMIT_TOKEN secret, so the GITHUB_TOKEN only needs read access for checkout and config loading.

jobs:
  configure_repo:
    runs-on: ubuntu-latest
    permissions:
      contents: read   # ← added

Copilot AI changed the title [WIP] Fix code scanning alert #3 Add explicit permissions to settings.yml workflow (alert #3) May 13, 2026
Copilot AI requested a review from antgrutta May 13, 2026 16:10
@antgrutta
antgrutta marked this pull request as ready for review May 13, 2026 16:13
@antgrutta
antgrutta requested a review from ssulei7 as a code owner May 13, 2026 16:13
Copilot AI review requested due to automatic review settings May 13, 2026 16:13

@antgrutta antgrutta left a comment

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.

Looks good, there is a separate token used for operating on the target organizations and repos so this is fine.

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.

Pull request overview

Adds an explicit least-privilege permissions block to the configure_repo job in .github/workflows/settings.yml, addressing CodeQL alert actions/missing-workflow-permissions (CWE-275). The privileged steps use a separate ISSUE_SUBMIT_TOKEN, so contents: read is sufficient for the default GITHUB_TOKEN.

Changes:

  • Add job-level permissions: contents: read to the configure_repo job.
Show a summary per file
File Description
.github/workflows/settings.yml Adds explicit contents: read permissions to the configure_repo job to satisfy least-privilege.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@antgrutta
antgrutta merged commit 8b672e0 into main May 13, 2026
8 checks passed
@antgrutta
antgrutta deleted the copilot/fix-code-scanning-alerts-3 branch May 13, 2026 16:17
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