Skip to content

Potential fix for code scanning alert no. 2: Workflow does not contain permissions - #66

Merged
Johan Broberg (pontemonti) merged 1 commit into
mainfrom
alert-autofix-2
Nov 14, 2025
Merged

Johan Broberg (pontemonti) merged 1 commit into
mainfrom
alert-autofix-2

Conversation

@pontemonti

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/microsoft/Agent365-nodejs/security/code-scanning/2

To fix this issue, you should add an explicit permissions block 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, the contents: read permission is sufficient and safest. Edit the .github/workflows/ci.yml file, adding the following under the nodejs-sdk job definition (right after line 46, under runs-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.

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: read to the nodejs-sdk job
  • 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-sdks job is also missing an explicit permissions block. Since this job only performs read-only operations (checkout and git diff), it should also have permissions: contents: read added for consistency and to address the same security concern. Add the permissions block after line 12, similar to the fix applied to the nodejs-sdk job.
  changed-sdks:
    name: Determine Changed SDKs
    runs-on: ubuntu-latest

@pontemonti
Johan Broberg (pontemonti) merged commit b3802ff into main Nov 14, 2025
13 checks passed
@pontemonti
Johan Broberg (pontemonti) deleted the alert-autofix-2 branch November 14, 2025 22:21
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.

3 participants