Skip to content

Potential fix for code scanning alert no. 6: Workflow does not contain permissions#24

Merged
nstarman merged 1 commit intomainfrom
alert-autofix-6
Oct 27, 2025
Merged

Potential fix for code scanning alert no. 6: Workflow does not contain permissions#24
nstarman merged 1 commit intomainfrom
alert-autofix-6

Conversation

@nstarman
Copy link
Contributor

Potential fix for https://github.com/GalacticDynamics/diffraxtra/security/code-scanning/6

The best way to fix this problem is to add an explicit permissions block to the workflow. This block can be set at the root of the workflow file (applies to all jobs unless overridden at the job level), or at individual job level if different jobs need different permissions. In this workflow, none of the jobs require write access to repository content; they only need to check out the code, install Python packages, and upload reports (e.g., to Codecov). Therefore, the minimal permission required is contents: read, which allows jobs to read repository contents, but prevents them from writing or manipulating repository resources.

The fix is:

  • Insert the permissions: block at the root level, immediately after the name: (or anywhere before jobs:), so that all jobs inherit the least-privilege contents: read.
  • No further code, import, or method changes are needed, as this is a YAML metadata addition.

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>
Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
@nstarman nstarman added this to the 1.5.x milestone Oct 27, 2025
@nstarman nstarman marked this pull request as ready for review October 27, 2025 03:21
@nstarman nstarman merged commit 85e8973 into main Oct 27, 2025
18 checks passed
@nstarman nstarman deleted the alert-autofix-6 branch October 27, 2025 03:23
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