Skip to content

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

Merged
dagerzuniga merged 1 commit into
masterfrom
alert-autofix-1
Mar 24, 2026
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#1
dagerzuniga merged 1 commit into
masterfrom
alert-autofix-1

Conversation

@dagerzuniga
Copy link
Copy Markdown

Potential fix for https://github.com/ltvco/txpdf/security/code-scanning/1

In general, the fix is to declare an explicit permissions block for the workflow or for the specific job, granting only the minimal scopes needed. For this workflow, the job checks out code, builds a Docker image, runs anchore/scan-action, and uploads a SARIF report via github/codeql-action/upload-sarif. None of these steps require write access to the repository via GITHUB_TOKEN; they only need to read the contents. Therefore, we can safely set permissions: contents: read at the workflow root so it applies to all jobs.

Concretely, in .github/workflows/grype.yml, add a permissions: section immediately after the name: (or just before jobs:). This will ensure the GITHUB_TOKEN has only read access to repository contents when this workflow runs. No imports or additional methods are needed since this is a YAML configuration change only, and it does not alter the runtime behavior of the workflow other than tightening security.

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>
@dagerzuniga dagerzuniga marked this pull request as ready for review March 24, 2026 17:07
@dagerzuniga dagerzuniga merged commit a767c7a into master Mar 24, 2026
3 of 5 checks passed
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