Skip to content

Potential fix for code scanning alert no. 4: Workflow does not contain permissions#55

Closed
exequielloza wants to merge 1 commit into
masterfrom
alert-autofix-4
Closed

Potential fix for code scanning alert no. 4: Workflow does not contain permissions#55
exequielloza wants to merge 1 commit into
masterfrom
alert-autofix-4

Conversation

@exequielloza
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/splightplatform/splight-agent/security/code-scanning/4

In general, the fix is to explicitly restrict the GITHUB_TOKEN permissions using a permissions: block, either at the workflow root (applies to all jobs) or individually per job, granting only what is needed. These jobs only need to read repository contents to run code formatters and version checks, so contents: read is sufficient.

The best fix here is to add a single top-level permissions: block after the name (or on) key in .github/workflows/developer.yaml, setting contents: read. This will apply to all three jobs (black, isort, verify-version) that currently lack permissions, without changing their functionality, since they only read repository files. No additional imports, methods, or definitions are needed; this is purely a YAML configuration change within the workflow file.

Concretely: in .github/workflows/developer.yaml, between line 1 (name: Code Quality) and line 2 (on: pull_request), insert:

permissions:
  contents: read

leaving the rest of the workflow unchanged.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…n permissions

https://splight.atlassian.net/browse/SECUR-434

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Exequiel Loza <exequiel.loza@splight.com>
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