Skip to content

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

Merged
AlexGalichenko merged 1 commit intomainfrom
alert-autofix-1
Nov 4, 2025
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#34
AlexGalichenko merged 1 commit intomainfrom
alert-autofix-1

Conversation

@AlexGalichenko
Copy link
Contributor

Potential fix for https://github.com/qavajs/steps-memory/security/code-scanning/1

To fix the referenced problem, add a permissions block explicitly either at the workflow root (to apply to all jobs), or at the job (publish-npm) level. Since this workflow only has a single job, either approach works; most maintainers put it at the root for future extensibility. As this workflow publishes to npm (which uses secrets for authentication rather than GITHUB_TOKEN), the only GitHub permission needed is for reading and possibly writing repository contents (esp. if tagging or making changes, but in this workflow, only publishing from existing contents). By least privilege, set permissions: contents: read at the root. However, if you know for sure that npm publish (with this setup) occasionally needs to update repotags, consider contents: write. The safest minimal change is to add:

permissions:
  contents: read

directly under the name: key, i.e., at the top of the file before the on block.

No new methods or imports are required for this fix—just add the correct configuration lines.

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>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 4, 2025

@AlexGalichenko AlexGalichenko marked this pull request as ready for review November 4, 2025 15:33
@AlexGalichenko AlexGalichenko merged commit 18541b2 into main Nov 4, 2025
8 checks passed
@AlexGalichenko AlexGalichenko deleted the alert-autofix-1 branch November 4, 2025 15:33
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