Skip to content

Potential fix for code scanning alert no. 1064: Workflow does not contain permissions#78

Merged
HosseinNejatiJavaremi merged 1 commit intomasterfrom
alert-autofix-1064
Aug 28, 2025
Merged

Potential fix for code scanning alert no. 1064: Workflow does not contain permissions#78
HosseinNejatiJavaremi merged 1 commit intomasterfrom
alert-autofix-1064

Conversation

@HosseinNejatiJavaremi
Copy link
Copy Markdown
Member

Potential fix for https://github.com/SyntaxArc/ArchiPy/security/code-scanning/1064

The best way to fix this problem is to add a permissions block at the appropriate level in the workflow file to limit the permissions of GITHUB_TOKEN to only what is required. Since the lint job only needs to read the code (e.g., to check out files, gather changed files, run the linter), it does not need write permissions. Therefore, adding permissions: contents: read either at the workflow root (to apply to all jobs) or within the lint job (to apply only there) is ideal. For clarity and future extensibility, placing it at the job-level ensures explicitness, but root-level is also acceptable if there’s only one job. You'll need to insert:

permissions:
  contents: read

either just after name: Lint (root-level), or on line 11, before runs-on: ubuntu-latest (job-level).


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

…tain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@HosseinNejatiJavaremi HosseinNejatiJavaremi marked this pull request as ready for review August 28, 2025 08:56
@HosseinNejatiJavaremi HosseinNejatiJavaremi merged commit 247090e into master Aug 28, 2025
5 checks passed
@HosseinNejatiJavaremi HosseinNejatiJavaremi deleted the alert-autofix-1064 branch August 28, 2025 08:57
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