Skip to content

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

Open
Yostra wants to merge 1 commit intomainfrom
alert-autofix-16
Open

Potential fix for code scanning alert no. 16: Workflow does not contain permissions#205
Yostra wants to merge 1 commit intomainfrom
alert-autofix-16

Conversation

@Yostra
Copy link
Copy Markdown
Collaborator

@Yostra Yostra commented Mar 30, 2026

Potential fix for https://github.com/stripe/sync-engine/security/code-scanning/16

In general, the problem is fixed by explicitly declaring a permissions block at the workflow or job level to constrain the automatically provided GITHUB_TOKEN. For a workflow that only needs to check out code and does not modify the repository on GitHub (no pushes, releases, PR writes, etc.), the minimal appropriate permissions are usually contents: read. This documents the intent and ensures the workflow remains least-privileged even if repository/organization defaults change.

The single best fix here is to add a permissions block at the top (root) level of .github/workflows/docker-image.yml, so that it applies to all jobs. We’ll set contents: read, which is sufficient for actions/checkout to read the repository. The Docker-related steps authenticate to Docker Hub via secrets and do not need broader GitHub API access. Concretely, in .github/workflows/docker-image.yml, insert:

permissions:
  contents: read

between the existing name: Stripe Build Image line and the on: block. No other changes, imports, or additions are needed.

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>
@Yostra Yostra marked this pull request as ready for review March 30, 2026 19:43
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