Skip to content

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#1538

Merged
drager merged 1 commit intomasterfrom
alert-autofix-1
Nov 30, 2025
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#1538
drager merged 1 commit intomasterfrom
alert-autofix-1

Conversation

@drager
Copy link
Member

@drager drager commented Nov 30, 2025

Potential fix for https://github.com/drager/wasm-pack/security/code-scanning/1

The best way to fix this problem is to add an explicit permissions block to the job (or to the root of the workflow, if preferred). Since no steps in the job modify repository contents, pull requests, issues, or anything outside of what contents: read permits, the safest and recommended configuration is to set contents: read. This limits the GITHUB_TOKEN permissions and adheres to the principle of least privilege. To implement this, edit .github/workflows/test.yml, and under either the root of the workflow or (typically better for clarity) under the job definition, add:

permissions:
  contents: read

If using job-scoped permissions, insert after line corresponding to the start of the job (test:) or after job name (name: Test). No imports, methods, or other code are needed.

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>
@drager drager marked this pull request as ready for review November 30, 2025 13:22
@drager drager merged commit 93c1818 into master Nov 30, 2025
9 checks passed
@drager drager deleted the alert-autofix-1 branch January 20, 2026 10:49
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.

1 participant