Skip to content

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

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

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

Conversation

@rossaddison
Copy link
Owner

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

In general, the problem is fixed by adding a permissions: section either at the top level of the workflow (to apply to all jobs) or under the specific job (jobs.tests) to explicitly scope down the GITHUB_TOKEN privileges. For this workflow, read-only access to repository contents is sufficient, as the steps only check out code, install dependencies, run tests, use cache, and upload coverage to Codecov.

The minimal, non-breaking fix in this file is to add permissions: contents: read at the workflow root (after name: mysql), which will apply to all jobs that do not define their own permissions. This aligns with CodeQL’s recommended minimal starting point (contents: read) and matches the actual needs of the workflow. No other code changes, imports, or definitions are needed.

Concretely, in .github/workflows/mysql.yml, insert:

name: mysql

permissions:
  contents: read

jobs:
  tests:
    ...

leaving the rest of the workflow unchanged.

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 12:04
@rossaddison rossaddison merged commit 259808b into master Dec 20, 2025
23 of 29 checks passed
@rossaddison rossaddison deleted the alert-autofix-3 branch December 20, 2025 12:04
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