Skip to content

Potential fix for code scanning alert no. 3: Workflow does not contain permissions#5

Merged
pmalarme merged 1 commit intomainfrom
alert-autofix-3
Feb 17, 2026
Merged

Potential fix for code scanning alert no. 3: Workflow does not contain permissions#5
pmalarme merged 1 commit intomainfrom
alert-autofix-3

Conversation

@pmalarme
Copy link
Owner

Potential fix for https://github.com/pmalarme/github-secrets/security/code-scanning/3

In general, the fix is to explicitly limit GITHUB_TOKEN permissions either at the workflow root (applies to all jobs) or per job, using the least privileges needed. Since this reusable workflow only echoes secrets/variables and writes to $GITHUB_STEP_SUMMARY and does not touch repository contents or make API mutations, it does not require write permissions; a minimal read-only permission set is sufficient.

The best way to fix this without changing existing functionality is to add a permissions: block at the top level of .github/workflows/reusable_workflow.yaml, directly under the name: (or before on:). This will apply to both run-reusable-workflow and run-reusable-workflow-without-environment. A conservative minimal configuration that matches GitHub’s recommended pattern but keeps the token read-only is:

permissions:
  contents: read

This ensures the token cannot write to repository contents or other resources while still allowing read access if some future step (like actions/checkout) is added. No imports or other code changes are needed; we only add this YAML block in the indicated region.

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>
@pmalarme pmalarme marked this pull request as ready for review February 17, 2026 15:20
@pmalarme pmalarme merged commit 30d543f into main Feb 17, 2026
2 checks passed
@pmalarme pmalarme deleted the alert-autofix-3 branch February 17, 2026 16:46
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