Skip to content

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

Merged
markmcdowell merged 1 commit intomainfrom
alert-autofix-1
Mar 31, 2026
Merged

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

Conversation

@markmcdowell
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/reactivemarkets/switchboard-api/security/code-scanning/1

In general, you fix this by adding an explicit permissions block either at the workflow root (applies to all jobs without their own permissions) or inside each job. For this CI workflow, the steps only read the repository contents and do not need to write anything back to GitHub, so we can safely restrict GITHUB_TOKEN to read‑only on contents.

The best minimal fix without changing existing functionality is to add a workflow‑level permissions block just below the name: ci line. This will apply to the build job and any future jobs that don’t override permissions. We’ll set contents: read, which is equivalent to GitHub’s “read‑only” default for repository contents and is sufficient for actions/checkout@v2 to function. No imports or additional methods are needed; this is a pure YAML configuration change within .github/workflows/ci.yml.

Concretely:

  • Edit .github/workflows/ci.yml.
  • Insert:
permissions:
  contents: read

between line 2 (name: ci) and line 3 (on:). No other changes 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>
@markmcdowell markmcdowell marked this pull request as ready for review March 31, 2026 22:05
@markmcdowell markmcdowell requested a review from a team as a code owner March 31, 2026 22:05
@markmcdowell markmcdowell self-assigned this Mar 31, 2026
@markmcdowell markmcdowell marked this pull request as draft March 31, 2026 22:06
@markmcdowell markmcdowell marked this pull request as ready for review March 31, 2026 22:06
@markmcdowell markmcdowell merged commit 3738cb9 into main Mar 31, 2026
1 check passed
@markmcdowell markmcdowell deleted the alert-autofix-1 branch March 31, 2026 22:07
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