improvement(governance): derived access#5134
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryHigh Risk Overview Organization admins are treated as workspace admins on every org workspace (roster, workspace lists, permission updates block demotion). Workspace admins are credential admins for shared credentials (OAuth, service accounts, workspace env vars)—listing, OAuth credential pickers, member APIs, and env secret read/edit rules follow that model; personal env vars stay private. Credential member APIs now merge workspace-admin rows with Settings UI adds Reviewed by Cursor Bugbot for commit e1241a0. Configure here. |
Greptile SummaryThis PR implements a governance inheritance model where org owners/admins are automatically workspace admins, and workspace admins are automatically credential admins on all shared (non-personal) credentials. The implementation is centralized in a new
Confidence Score: 5/5Safe to merge; the governance inheritance is correctly centralized in a shared package and consistently applied across workspace and credential access checks. The core derivation logic in
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User] -->|member.role = owner/admin?| B{Org Admin?}
B -->|Yes| C[Derived Workspace Admin]
B -->|No| D[Check permissions table]
D -->|explicit row| E{permissionType}
E -->|admin| F[Workspace Admin]
E -->|write/read/null| G[Workspace write/read/none]
C --> F
F -->|isSharedCredentialType?| H{Shared Credential?}
H -->|Yes env_workspace, oauth, service_account| I[Derived Credential Admin]
H -->|No env_personal| J[Check credentialMember table]
J -->|role=admin, status=active| K[Explicit Credential Admin]
J -->|other/none| L[Credential member/no access]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[User] -->|member.role = owner/admin?| B{Org Admin?}
B -->|Yes| C[Derived Workspace Admin]
B -->|No| D[Check permissions table]
D -->|explicit row| E{permissionType}
E -->|admin| F[Workspace Admin]
E -->|write/read/null| G[Workspace write/read/none]
C --> F
F -->|isSharedCredentialType?| H{Shared Credential?}
H -->|Yes env_workspace, oauth, service_account| I[Derived Credential Admin]
H -->|No env_personal| J[Check credentialMember table]
J -->|role=admin, status=active| K[Explicit Credential Admin]
J -->|other/none| L[Credential member/no access]
Reviews (4): Last reviewed commit: "chore(db): regenerate kb→workspace casca..." | Re-trigger Greptile |
|
@greptile |
|
bugbot run |
|
@greptile |
|
bugbot run |
Our 0242 collides with staging's 0242. Remove it (and its snapshot + journal entry) so the KB-cascade migration can be regenerated with the correct number on top of the merged staging migrations.
Regenerated via drizzle-kit generate on top of the merged staging migrations (staging took 0242). Re-applied the safety edits: NOT VALID + separate VALIDATE on the FK re-add, and the -- migration-safe note on the DROP. check:migrations passes.
|
@greptile |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e1241a0. Configure here.
Summary
Org Admins are auto Workspace Admins. And workspace admins are auto credential admins.
Type of Change
Testing
Tested manually
Checklist