Skip to content

Show native OAuth project limits in auth status - #325

Open
masnwilliams wants to merge 1 commit into
mainfrom
hypeship/auth-status-native-projects
Open

masnwilliams wants to merge 1 commit into
mainfrom
hypeship/auth-status-native-projects

Conversation

@masnwilliams

@masnwilliams masnwilliams commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

kernel auth status decides its "Access scope" line from the token response's access_scope and project_id. Tokens from the native authorization server limit a grant to chosen projects through its policy and list them in a separate projects field, with access_scope: organization and no project_id. The CLI ignored that field, so a sign-in limited to one project showed "organization-wide". Enforcement was already correct; only the display was wrong.

  • Store projects from the token response on login, and keep it across refreshes that omit it.
  • auth status shows project <id> for one project, projects <id>, <id> for several, and organization-wide only when the grant isn't limited.
  • Legacy project-scoped tokens (access_scope: project) display as before.

Testing

  • go test ./pkg/auth/ ./cmd/: new tests for storing projects on exchange and keeping them on refresh, and for the scope label.
  • Not run against a live sign-in.

Note

Low Risk
Display and token metadata only; no changes to request authorization or credential handling beyond persisting an extra OAuth field.

Overview
Corrects kernel auth status so the Access scope line reflects native OAuth grants that cap access via a projects list (with access_scope: organization) instead of wrongly showing organization-wide.

TokenStorage now keeps a projects slice parsed from token exchange responses via projectsFromResponse, and refresh preserves it when the refresh payload omits the field. accessScopeLabel drives the status output: single project, comma-separated multiple projects, legacy access_scope: project + project_id, or organization-wide when unrestricted.

Adds unit tests for scope labeling and for storing/retaining native project limits across refresh.

Reviewed by Cursor Bugbot for commit 4aa9834. Bugbot is set up for automated code reviews on this repo. Configure here.

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