Potential fix for code scanning alert no. 2: Workflow does not contain permissions - #66
Merged
Merged
Conversation
…n permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Johan Broberg (pontemonti)
marked this pull request as ready for review
November 14, 2025 21:37
Copilot started reviewing on behalf of
Johan Broberg (pontemonti)
November 14, 2025 21:38
View session
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a code scanning security alert by adding an explicit permissions block to the nodejs-sdk job in the CI workflow. The change follows the principle of least privilege by restricting the job to read-only access to repository contents.
- Adds
permissions: contents: readto thenodejs-sdkjob - Ensures the job has minimal required privileges for its read-only operations (build, test, artifact upload)
Comments suppressed due to low confidence (1)
.github/workflows/ci.yml:12
- The
changed-sdksjob is also missing an explicitpermissionsblock. Since this job only performs read-only operations (checkout and git diff), it should also havepermissions: contents: readadded for consistency and to address the same security concern. Add the permissions block after line 12, similar to the fix applied to thenodejs-sdkjob.
changed-sdks:
name: Determine Changed SDKs
runs-on: ubuntu-latest
Rahul Devikar (rahuldevikar761)
approved these changes
Nov 14, 2025
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/microsoft/Agent365-nodejs/security/code-scanning/2
To fix this issue, you should add an explicit
permissionsblock with the minimal required privileges to the affected job (nodejs-sdk). Since the steps performed are read-only (building, testing, artifact upload) and do not modify repository contents or interact with issues/pull-requests, thecontents: readpermission is sufficient and safest. Edit the.github/workflows/ci.ymlfile, adding the following under thenodejs-sdkjob definition (right after line 46, underruns-on: ubuntu-latest). No imports or further code changes are required—just this YAML configuration block.Suggested fixes powered by Copilot Autofix. Review carefully before merging.