Skip to content

Potential fix for code scanning alert no. 1: Workflow does not contain permissions - #334

Merged
garloff merged 1 commit into
mainfrom
alert-autofix-1
Dec 1, 2025
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#334
garloff merged 1 commit into
mainfrom
alert-autofix-1

Conversation

@garloff

@garloff garloff commented Nov 28, 2025

Copy link
Copy Markdown
Member

Potential fix for https://github.com/SovereignCloudStack/docs/security/code-scanning/1

The problem is that the workflow does not explicitly specify its permissions, allowing the GITHUB_TOKEN to inherit potentially excessive permissions. To fix this, the workflow should declare a minimum set of permissions. In this case, since the job only checks out code and runs a link checker (which does not modify repository contents, issues, or PRs), it should be sufficient to set contents: read at either the workflow or the job level.

As shown, the workflow contains only a single job, so it is simpler to add the permissions block at the root level (top of the file, immediately after the name:), which will apply the permissions to all jobs unless overridden. No additional imports or dependencies are needed.

Edit .github/workflows/link-validator.yml as follows:

  • Add a root-level permissions: key (right below the name: and above jobs:) with {contents: read}.

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: Kurt Garloff <kurt@garloff.de>
@garloff
garloff marked this pull request as ready for review November 28, 2025 12:07

@garloff garloff left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@garloff
garloff merged commit cee19a6 into main Dec 1, 2025
6 checks passed
@garloff
garloff deleted the alert-autofix-1 branch December 1, 2025 10:44
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.

2 participants