Skip to content

Potential fix for code scanning alert no. 91: Workflow does not contain permissions#220

Merged
hittyt merged 1 commit intomainfrom
alert-autofix-91
Feb 12, 2026
Merged

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

Conversation

@Pangjiping
Copy link
Collaborator

Potential fix for https://github.com/alibaba/OpenSandbox/security/code-scanning/91

In general, the fix is to add a permissions block that restricts the GITHUB_TOKEN to the least privileges needed. Since this workflow only needs to read the repository contents (for actions/checkout) and does not appear to modify anything via the GitHub API, contents: read at the workflow or job level is sufficient.

The best minimal fix without changing functionality is to add a top-level permissions section right under the workflow name: (before on:). This will apply to all jobs that do not override permissions, including the publish job. Concretely, in .github/workflows/publish-components.yml, insert:

permissions:
  contents: read

after line 1 (name: Publish Components Image). No additional imports, methods, or definitions are required; this is purely a YAML configuration change.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…in permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Pangjiping Pangjiping marked this pull request as ready for review February 9, 2026 14:18
Copy link
Collaborator

@hittyt hittyt left a comment

Choose a reason for hiding this comment

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

LGTM

@hittyt hittyt merged commit 187a0c6 into main Feb 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants