Potential fix for code scanning alert no. 2: Workflow does not contain permissions#7
Merged
JosunLP merged 1 commit intodevelopmentfrom Jan 23, 2026
Merged
Conversation
…n permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces default GITHUB_TOKEN privileges in the npm publish workflow to address the code scanning alert about missing explicit workflow/job permissions.
Changes:
- Adds
permissions: contents: readto thebuildjob. - Adds
permissions: contents: readto thebuild-docsjob.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/bQuery/bQuery/security/code-scanning/2
In general, the fix is to add explicit
permissionsblocks to jobs (or at the workflow root) so thatGITHUB_TOKENhas only the minimal rights required. For simple build/test jobs that only need to fetch source viaactions/checkout,contents: readis sufficient. Jobs that publish packages or deploy pages can retain their more permissive, already‑declared permissions.For this workflow, we should add
permissions: contents: readto thebuildandbuild-docsjobs. This keeps existing functionality unchanged:actions/checkout@v4works withcontents: read, and the rest of the steps only run local commands (bun install,bun test,bun run build,bun run build:docs,actions/upload-pages-artifact@v3) that do not require extra GitHub permissions. Thepublish-npmanddeploy-pagesjobs already have appropriate explicit permissions and should be left as is.Concretely:
.github/workflows/npm-publish.yml, underjobs.build, insert:runs-on.jobs.build-docs, also insert:runs-on.No additional imports, methods, or external definitions are required, since this is purely a workflow‑YAML change.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.