Skip to content

feat(labrinth): staff PAT scopes - #8241

Merged
mergify[bot] merged 10 commits into
mainfrom
fetch/pat-admin-scopes
Nov 10, 2026
Merged

mergify[bot] merged 10 commits into
mainfrom
fetch/pat-admin-scopes

Conversation

@fetchfern

Copy link
Copy Markdown
Member

No description provided.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

@fetchfern

Copy link
Copy Markdown
Member Author

@greptile

@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: plus

[High impact] Credential scopes now shape access across staff tools and many API workflows.

Fix the two project read checks before merging so read-only staff PATs work without write access.

Reviews (3) · Last reviewed commit: "fix: let ADMIN_READ view analytics for a..." · Reviewed by Greptile

Comment thread apps/labrinth/src/routes/v3/users.rs Resolved
Comment thread apps/labrinth/src/models/v3/teams.rs Resolved
Comment thread apps/labrinth/src/auth/checks.rs Resolved
Comment thread apps/labrinth/tests/pats.rs Resolved
@Prospector

Copy link
Copy Markdown
Member

mmm yeah admin scope should always include moderator scopes

fetchfern and others added 4 commits November 5, 2026 19:09
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: François-Xavier Talbot <108630700+fetchfern@users.noreply.github.com>
@fetchfern

Copy link
Copy Markdown
Member Author

@greptile

@greptile-apps

greptile-apps Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

  • P1 Read-only admins lose analytics apps/labrinth/src/models/v3/teams.rs:95 ▶

    Removing the ADMIN_READ permissions also breaks read-only analytics access. An admin PAT with ADMIN_READ | ANALYTICS, but no ADMIN_WRITE, now loses every requested project where its user lacks VIEW_ANALYTICS. filter_allowed_project_ids still uses this helper, so those projects silently disappear from the results.

    Keep this helper write-only, but add an ADMIN_READ override in the analytics read check.

@fetchfern
fetchfern marked this pull request as ready for review November 9, 2026 23:12
Comment thread apps/labrinth/src/auth/validate.rs Outdated
Comment on lines +25 to +38
pub fn into_user(self) -> User {
self.user
}

pub fn to_user(&self) -> User {
self.user.clone()
}

/// Whether the credentials grant all of `scopes`.
pub fn has_scopes(&self, scopes: Scopes) -> bool {
self.scopes.contains(scopes)
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

user, scopes are public fields already. Not much point in hiding these behind into_ and to_ accessors,

  • user.to_user().foo() -> user.user.foo()
  • user.has_scopes(Scopes::SOMETHING) -> user.scopes.contains(Scopes::SOMETHING)

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Queue requested — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

✅ Merged into main as b7b7dfd at 19:33 UTC

Less than a minute in the queue, with no time running CI.

So far

  • ✅ Entered the queue Tue 10 Nov, 19:33 · rule default · triggered by @fetchfern with the merge queue checkbox
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged 19:33 · b7b7dfd
2 merge conditions met
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = Lint and Test
    • check-neutral = Lint and Test
    • check-skipped = Lint and Test

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 10, 2026
@mergify
mergify Bot merged commit b7b7dfd into main Nov 10, 2026
11 checks passed
@mergify
mergify Bot deleted the fetch/pat-admin-scopes branch November 10, 2026 19:33
@mergify mergify Bot removed the queued label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants