Skip to content

.github/workflows/docs-pr.yaml: Potential fix for code scanning alert no. 2: Workflow does not contain permissions#2746

Draft
mykaul wants to merge 1 commit intomasterfrom
github/workflows/docs-pr.yaml-alert-autofix-2
Draft

.github/workflows/docs-pr.yaml: Potential fix for code scanning alert no. 2: Workflow does not contain permissions#2746
mykaul wants to merge 1 commit intomasterfrom
github/workflows/docs-pr.yaml-alert-autofix-2

Conversation

@mykaul
Copy link
Contributor

@mykaul mykaul commented Dec 23, 2025

Potential fix for https://github.com/scylladb/scylla-monitoring/security/code-scanning/2

To fix the problem, explicitly declare minimal GITHUB_TOKEN permissions for this workflow or for the specific job. Since the job only needs to read the repository to build and test docs, contents: read is sufficient. Adding a permissions block ensures the workflow doesn’t accidentally get broader write permissions inherited from repo/org defaults.

The best fix without changing functionality is to add a workflow-level permissions block right after the name (or before on:) so it applies to all jobs in this workflow. That block should set contents: read. No further permissions are needed for the existing steps (actions/checkout, actions/setup-python, and make commands that run locally). Concretely, in .github/workflows/docs-pr.yaml, insert:

permissions:
  contents: read

near the top of the file. No new methods, imports, or other definitions are required, because this is purely a configuration change within the workflow file.

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>
@mykaul mykaul changed the title Potential fix for code scanning alert no. 2: Workflow does not contain permissions .github/workflows/docs-pr.yaml: Potential fix for code scanning alert no. 2: Workflow does not contain permissions Dec 23, 2025
@annastuchlik
Copy link
Contributor

@dgarcia360 Please have a look.

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.

3 participants

Comments