Skip to content

Potential fix for code scanning alert no. 7: Workflow does not contain permissions#16

Merged
hippieZhou merged 1 commit intomainfrom
alert-autofix-7
Sep 4, 2025
Merged

Potential fix for code scanning alert no. 7: Workflow does not contain permissions#16
hippieZhou merged 1 commit intomainfrom
alert-autofix-7

Conversation

@hippieZhou
Copy link
Owner

Potential fix for https://github.com/hippieZhou/hippiezhou.github.io/security/code-scanning/7

The best fix is to explicitly add a permissions block to the performance-check job (and optionally to the build-and-test job) to restrict the token’s capabilities, following the principle of least privilege. As performance-check seems only to download artifacts and run local checks, it only needs contents: read or potentially could set permissions: {} (none). However, downloading artifacts requires read access to contents (or uses default), so contents: read is the minimal appropriate permission.

To implement this fix:

  • In .github/workflows/deploy-pages.yml, under the performance-check (line 307) job definition, add a permissions block with contents: read.
  • No other code changes, imports, or method definitions are necessary.

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>
@hippieZhou hippieZhou marked this pull request as ready for review September 4, 2025 05:31
@hippieZhou hippieZhou merged commit d5eafe6 into main Sep 4, 2025
4 checks passed
@hippieZhou hippieZhou deleted the alert-autofix-7 branch September 4, 2025 05:32
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