Conversation
…n permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…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
This PR adds explicit permission declarations to GitHub Actions workflows to follow the principle of least privilege. The changes restrict workflow permissions to read-only access to repository contents.
- Added top-level
permissionsblock to the publish workflow - Added job-level
permissionsblock to the build job in the nodejs workflow
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/publish.yml | Added top-level permissions setting with read-only contents access |
| .github/workflows/nodejs.yml | Added job-level permissions setting with read-only contents access for the build job |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
llastflowers
approved these changes
Nov 5, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 fixes for 2 code scanning alerts
https://github.com/github/text-expander-element/security/code-scanning/4
To address the problem, add an explicit
permissions:key to restrict the GITHUB_TOKEN in the workflow. This is most effective when added at the workflow root, applying it to all jobs unless individually overridden. The minimal recommended setting iscontents: read, which is sufficient unless the workflow (or specific job steps) truly requires additional permissions. In the provided workflow, publishing to npm usesNODE_AUTH_TOKENfrom secrets and does not require GITHUB_TOKEN write access, socontents: readis the safest starting point. The edit should occur at the root of the workflow, for instance between thename:andon:keys. No additional imports or external dependencies are needed.https://github.com/github/text-expander-element/security/code-scanning/3
To fix the issue, add a
permissionsblock specifying the minimal required privileges for the job. Since the workflow installs dependencies, runs a build, and tests, but does not write to the repository or perform operations requiring more privileges,contents: readis sufficient. Place the block at the job-level (build:job) since the job is flagged, or alternatively at the workflow root to cover all jobs. In this case, adding it under thebuild:job is clear and direct.Edit
.github/workflows/nodejs.ymland insert:immediately after the job name (
build:), beforeruns-on:.No additional methods, imports, or dependencies are needed.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.