Skip to content

feat(auth): add PAT scope presets - #42

Merged
Eli Bosley (elibosley) merged 7 commits into
mainfrom
agent/pat-permissions
Jul 30, 2026
Merged

feat(auth): add PAT scope presets#42
Eli Bosley (elibosley) merged 7 commits into
mainfrom
agent/pat-permissions

Conversation

@elibosley

@elibosley Eli Bosley (elibosley) commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

Adds classic-PAT presets for repository runners, organization runners, and private GHCR image pulls. Also adds a separate read:packages-only GHCR pull-token shortcut.

Why

The prior pre-scoped PAT link omitted read:packages, so a token could mint organization runner registration tokens but still be denied when Docker pulled a private ghcr.io runner image.

User impact

Operators can choose a least-privilege preset matching their runner scope and image source. The saved configuration preselects the matching repository/org and GHCR combination; users can also save a separate package-only registry token.

Validation

  • php -l src/usr/local/emhttp/plugins/ci-runner-farm/RunnerFarmSettings.page
  • bash -n src/usr/local/emhttp/plugins/ci-runner-farm/include/runner-farm.sh
  • ./tests/config-parity.sh
  • ./tests/safe-paths.sh (skipped: GNU realpath -m is unavailable on this host)
  • git diff --check

Summary by CodeRabbit

  • New Features
    • Added GitHub classic token permission presets for repository, organization, and private container registry scenarios.
    • Added a separate “packages” token option for private container registry use.
    • Updated the settings UI to guide preset selection and launch GitHub’s token creation with preset scopes.
  • Documentation
    • Updated setup guidance for creating and securely storing tokens, including least-privilege scopes, token storage path/permissions, and SSO authorization requirements.
    • Clarified additional token scope expectations for organization and private registry usage.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@elibosley, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f60f99b-8912-45dc-84d1-d11753212267

📥 Commits

Reviewing files that changed from the base of the PR and between e275f24 and fbe396a.

📒 Files selected for processing (1)
  • src/usr/local/emhttp/plugins/ci-runner-farm/RunnerFarmSettings.page
📝 Walkthrough

Walkthrough

The PR replaces pre-scoped PAT links with classic PAT presets, adds client-side GitHub token creation, and documents token storage, required scopes, optional package tokens, and SSO authorization.

Changes

Classic PAT setup

Layer / File(s) Summary
PAT preset generation and creation
src/usr/local/emhttp/plugins/ci-runner-farm/RunnerFarmSettings.page
Derives repository, organization, and GHCR presets; renders preset controls; opens GitHub token creation with mapped scopes.
Token storage and scope guidance
README.md, src/usr/local/emhttp/plugins/ci-runner-farm/include/runner-farm.sh
Documents secure token storage, expanded PAT scopes, optional package-only tokens, and SSO authorization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: jmagar

Poem

A bunny picks scopes, neat and bright,
Classic tokens hop into sight.
GHCR packages follow the trail,
Secure files guard every detail.
SSO gets a nod, and off we go!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses a conventional commit prefix and accurately summarizes the PAT scope preset changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/pat-permissions
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch agent/pat-permissions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/usr/local/emhttp/plugins/ci-runner-farm/RunnerFarmSettings.page`:
- Around line 59-66: Clarify the classic PAT’s resource scope in the preset
guidance near the select with id crf-pat-preset: state that it is account-wide
across the token owner’s accessible repositories and recommend using a dedicated
service account/token. Also update the README authentication guidance at the
specified section to define “least privilege” as minimum classic PAT scopes, not
per-repository or per-organization credentials.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a235f081-d872-48b9-9e13-7490a63952fc

📥 Commits

Reviewing files that changed from the base of the PR and between fe35981 and 2b2a487.

📒 Files selected for processing (3)
  • README.md
  • src/usr/local/emhttp/plugins/ci-runner-farm/RunnerFarmSettings.page
  • src/usr/local/emhttp/plugins/ci-runner-farm/include/runner-farm.sh

Comment thread src/usr/local/emhttp/plugins/ci-runner-farm/RunnerFarmSettings.page Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/usr/local/emhttp/plugins/ci-runner-farm/RunnerFarmSettings.page`:
- Line 69: Update the .crfs-pat-note styling in the token controls layout to use
flex: 0 0 100%, ensuring the PAT guidance occupies its own full-width row
beneath the controls at all screen widths. Apply the same change to the
corresponding second occurrence.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b3534c4-bea4-42a2-8fb7-e2027ad95bd1

📥 Commits

Reviewing files that changed from the base of the PR and between 2b2a487 and e275f24.

📒 Files selected for processing (2)
  • README.md
  • src/usr/local/emhttp/plugins/ci-runner-farm/RunnerFarmSettings.page
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

Comment thread src/usr/local/emhttp/plugins/ci-runner-farm/RunnerFarmSettings.page Outdated
@elibosley
Eli Bosley (elibosley) marked this pull request as ready for review July 30, 2026 22:08
@elibosley
Eli Bosley (elibosley) merged commit 15f073e into main Jul 30, 2026
3 checks passed
@elibosley
Eli Bosley (elibosley) deleted the agent/pat-permissions branch July 30, 2026 22:09
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