Add project-scoped OAuth authorization - #138
Open
masnwilliams wants to merge 8 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b10cb02. Configure here.
|
i dont know too much about ts, so take it or leave it:
the behavior and test coverage are headed in the right direction, but these are authorization boundaries and long-lived flows. i’d rather simplify and harden the structure now than preserve the added incidental complexity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

summary
tests
bun test(107 passing)bun run buildwith test build-time configurationdependency
Requires kernel/kernel#3165 to be deployed before this change writes structured OAuth contexts.
Note
High Risk
Changes authentication, authorization boundaries, and token/refresh persistence; incorrect scope handling could over- or under-grant API access, and deployment depends on kernel#3165 for structured contexts.
Overview
Adds organization-wide vs single-project OAuth consent, with project-scoped tokens locked to one Kernel project and organization-wide grants unchanged for existing clients.
The org picker becomes a two-step flow: pick an org, then choose entire organization or a searchable active project (via new
GET /oauth/projects). Selection is sent to/authorizeasaccess_scope/project_id, validated against the user’s active org and (for projects) the Kernel API.Authorization context replaces Redis org-only strings with structured scope (org + optional
project_id), stored on PKCE-bound requests, JWTs, and refresh tokens./authorizeenforces S256 PKCE for shared clients and all project grants;/tokenresolves scope only from server-side storage, strips client-supplied scope params before Clerk, checks JWT subject and org membership, returnsorg_id/access_scope/project_id, and blocks refresh-time scope escalation. Legacyorg_*Redis values still decode as organization-wide.Routes are refactored for testable dependencies; broad Bun tests cover authorize, token, register, projects, and context helpers. README documents the new consent behavior.
Reviewed by Cursor Bugbot for commit 320ddc3. Bugbot is set up for automated code reviews on this repo. Configure here.