Skip to content

ci: scope test workflows to least-privilege contents:read#37

Merged
JohnMcLear merged 1 commit into
mainfrom
ci/least-privilege-test-tokens
Jun 2, 2026
Merged

ci: scope test workflows to least-privilege contents:read#37
JohnMcLear merged 1 commit into
mainfrom
ci/least-privilege-test-tokens

Conversation

@JohnMcLear

Copy link
Copy Markdown
Member

Follow-up to #36. Qodo flagged on #36 that backend-tests now runs PR-controlled code on every PR (including forks) without an explicit permissions: block, so it inherits repo-default GITHUB_TOKEN scopes — against least-privilege.

#36 was auto-merged before this hardening commit landed, so re-submitting it standalone:

  • backend-tests job → permissions: contents: read
  • frontend-tests job → permissions: contents: read (also runs PR/fork code)

Both jobs only check out and run the plugin; they need no write scopes. The release job keeps its own elevated permissions in test-and-release.yml.

🤖 Generated with Claude Code

Qodo flagged that backend-tests now runs PR-controlled code on every PR
(including forks) without an explicit permissions: block, inheriting
repo-default GITHUB_TOKEN scopes. Both test jobs only check out and run
the plugin, so pin them to contents:read. The release job keeps its own
elevated scopes in test-and-release.yml.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Review Summary by Qodo

Add least-privilege permissions to test workflows

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add explicit least-privilege permissions to test workflows
• Restrict backend-tests job to contents:read scope
• Restrict frontend-tests job to contents:read scope
• Prevent PR-controlled code from inheriting elevated token scopes
Diagram
flowchart LR
  A["Test Workflows"] -->|"Add permissions block"| B["contents: read"]
  B -->|"Applied to"| C["backend-tests job"]
  B -->|"Applied to"| D["frontend-tests job"]
  C -->|"Prevents"| E["Elevated token scopes"]
  D -->|"Prevents"| E

Loading

Grey Divider

File Changes

1. .github/workflows/backend-tests.yml Security +5/-0

Add least-privilege permissions to backend-tests

• Added explicit permissions: block with contents: read scope
• Included explanatory comment about least-privilege principle
• Prevents PR-controlled code from inheriting repo-default token scopes

.github/workflows/backend-tests.yml


2. .github/workflows/frontend-tests.yml Security +4/-0

Add least-privilege permissions to frontend-tests

• Added explicit permissions: block with contents: read scope
• Included explanatory comment about least-privilege principle
• Restricts token access for PR-controlled plugin code execution

.github/workflows/frontend-tests.yml


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 2, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

@JohnMcLear JohnMcLear merged commit 31c5a79 into main Jun 2, 2026
3 checks passed
@JohnMcLear JohnMcLear deleted the ci/least-privilege-test-tokens branch June 2, 2026 15:25
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant