Skip to content

ci: set workflow permissions#1316

Open
Belco90 wants to merge 1 commit into
mainfrom
alert-autofix-4
Open

ci: set workflow permissions#1316
Belco90 wants to merge 1 commit into
mainfrom
alert-autofix-4

Conversation

@Belco90
Copy link
Copy Markdown
Member

@Belco90 Belco90 commented May 13, 2026

Potential fix for https://github.com/testing-library/eslint-plugin-testing-library/security/code-scanning/4

In general, fix this by adding an explicit permissions block either at the workflow root (to cover all jobs) or on the specific job, granting only the minimal required scopes. For a workflow that only reads workflow/job state and does not interact with repository contents or PRs, it is safe to set permissions: contents: read at the workflow level; this is the common minimal baseline and aligns with GitHub’s recommendation for read-only defaults.

The best targeted fix here is to define permissions at the workflow root, just below name: CI, so that both verifications and required-checks jobs inherit it unless they define their own. Given the information in the snippet, the minimal sane configuration is:

permissions:
  contents: read

This explicitly restricts GITHUB_TOKEN to read-only repository contents, which is sufficient for typical CI and avoids unexpected write capabilities. No new imports, actions, or logic changes are needed; only the YAML workflow header is updated. Concretely, in .github/workflows/ci.yml, insert a permissions block after line 1 and before on: at line 3.

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>
Signed-off-by: Mario Beltrán <me@belco.dev>
@Belco90 Belco90 marked this pull request as ready for review May 13, 2026 06:03
@Belco90 Belco90 requested a review from a team May 13, 2026 06:03
@Belco90 Belco90 self-assigned this May 13, 2026
@Belco90 Belco90 changed the title Potential fix for code scanning alert no. 4: Workflow does not contain permissions ci: set workflow permissions May 13, 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.

2 participants