Skip to content

Comments

Potential fix for code scanning alert no. 2: Workflow does not contain permissions#188

Merged
AmelBawa-msft merged 1 commit intomainfrom
alert-autofix-2
Nov 25, 2025
Merged

Potential fix for code scanning alert no. 2: Workflow does not contain permissions#188
AmelBawa-msft merged 1 commit intomainfrom
alert-autofix-2

Conversation

@AmelBawa-msft
Copy link
Contributor

Potential fix for https://github.com/microsoft/winget-studio/security/code-scanning/2

To fix this issue, add a permissions block to the job or the root of the workflow YAML file. For this case, since the flagged error is within the publish-winget job, the best fix is to set a minimal permissions block inside that job. This block should give contents: read (required to read repo contents) and only grant pull-requests: write if the workflow might submit PRs using wingetcreate. Place it as the first key under the job (before runs-on is standard). No functional changes elsewhere are needed; just add this YAML section. Specifically, add:

permissions:
  contents: read
  pull-requests: write

as lines immediately below line 9 in .github/workflows/winget.yml.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@AmelBawa-msft AmelBawa-msft marked this pull request as ready for review November 22, 2025 01:03
@AmelBawa-msft AmelBawa-msft merged commit 1be47ed into main Nov 25, 2025
8 checks passed
@AmelBawa-msft AmelBawa-msft deleted the alert-autofix-2 branch November 25, 2025 18:40
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.

2 participants