Skip to content

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

Closed
Yostra wants to merge 1 commit intomainfrom
alert-autofix-3
Closed

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

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/3

In general, the problem is fixed by adding an explicit permissions block that scopes the GITHUB_TOKEN to the least privileges required. For a typical CI workflow that only checks out source code and runs tests, contents: read at the workflow or job level is sufficient. This documents the intended permissions and prevents the workflow from inheriting broader defaults if repository or organization settings change.

The best way to fix this specific workflow without changing existing behavior is to add a minimal permissions block at the top (root) of the workflow, just under name: CI (or above on:). This will apply to all jobs (test and e2e-test), and both appear to only need read access to repository contents. No step in the snippet pushes commits, creates releases, modifies issues, or otherwise requires write permissions. Thus, we can safely specify:

permissions:
  contents: read

Only .github/workflows/ci.yml needs to be edited, and no additional methods, imports, or definitions are required.

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>
@Yostra
Copy link
Copy Markdown
Collaborator Author

Yostra commented Mar 30, 2026

this is duplicate

@Yostra Yostra closed this Mar 30, 2026
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