Skip to content

Potential fix for code scanning alert no. 3: Workflow does not contain permissions#3256

Merged
kylecorry31 merged 2 commits into
mainfrom
alert-autofix-3
Dec 3, 2025
Merged

Potential fix for code scanning alert no. 3: Workflow does not contain permissions#3256
kylecorry31 merged 2 commits into
mainfrom
alert-autofix-3

Conversation

@kylecorry31
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/kylecorry31/Trail-Sense/security/code-scanning/3

To fix this problem, an explicit permissions block needs to be added, containing only the minimum required privileges for this workflow. The job creates pull requests through the peter-evans/create-pull-request action, so it needs pull-requests: write permission. For most use cases, contents: read is also specified to maintain repository read access, but elevated permissions like contents: write are not required since all code changes are pushed through a PR, not directly to the default branch.

The best way to fix this is to add the following at the root (top-level) of the workflow YAML file (after the name and before on: block):

permissions:
  contents: read
  pull-requests: write

Alternatively, you can add it within the specific job, but top-level is preferred as it is more clear and applies to all jobs unless individually overridden.

File/line to change:
.github/workflows/contributors.yml, just after the name: Update Contributors line (before on:).

No new imports or methods are required for this change.


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>
@kylecorry31 kylecorry31 marked this pull request as ready for review December 3, 2025 20:31
@kylecorry31 kylecorry31 enabled auto-merge December 3, 2025 20:31
@kylecorry31 kylecorry31 disabled auto-merge December 3, 2025 22:26
@kylecorry31 kylecorry31 merged commit 6071c60 into main Dec 3, 2025
6 of 7 checks passed
@kylecorry31 kylecorry31 deleted the alert-autofix-3 branch January 18, 2026 20:53
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.

1 participant