Skip to content

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

Merged
rossaddison merged 1 commit intomasterfrom
alert-autofix-9
Dec 20, 2025
Merged

Potential fix for code scanning alert no. 9: Workflow does not contain permissions#6
rossaddison merged 1 commit intomasterfrom
alert-autofix-9

Conversation

@rossaddison
Copy link
Owner

Potential fix for https://github.com/rossaddison/data-cycle/security/code-scanning/9

In general, the fix is to explicitly set a permissions block either at the top (workflow-level, applying to all jobs by default) or within the specific job. Here we only have one job (tests), so either location works. To avoid changing behavior while still following least-privilege, the best starting point is the recommended minimal permissions contents: read, which is sufficient for actions/checkout, actions/cache, and typical test/coverage workflows that do not write to the repository or manage PRs.

The single best fix here is to add a workflow-level permissions block right after the name: pgsql line, applying to all jobs. That keeps functionality unchanged (the job will still be able to check out code and run tests) while reducing the GITHUB_TOKEN to read-only contents. No additional methods, imports, or external definitions are required because this is just YAML configuration. Only .github/workflows/pgsql.yml needs to be edited, and only around the workflow header (after line 23).

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>
@rossaddison rossaddison marked this pull request as ready for review December 20, 2025 11:32
@rossaddison rossaddison merged commit e7b2d6a into master Dec 20, 2025
24 of 30 checks passed
@rossaddison rossaddison deleted the alert-autofix-9 branch December 20, 2025 12:09
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