improvement(api): migrate policy-sensitive v2 reads - #6410
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview Internal Credentials add Reviewed by Cursor Bugbot for commit a6eba68. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR migrates policy-sensitive v2 reads and the internal audit-log read to shared Principal-backed application use cases while preserving their public response envelopes.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/audit-logs/route.ts | Migrates the internal audit-log endpoint to the declarative route builder and shared authorized list operation while retaining its existing envelope. |
| apps/sim/app/api/v2/audit-logs/route.ts | Moves v2 audit-log listing behind shared API-key authentication, rate limiting, operation metadata, and Principal-aware authorization. |
| apps/sim/lib/audit-logs/application/authorized-audit-log-use-case.ts | Centralizes audit-log principal restrictions and organization authorization for list and detail reads. |
| apps/sim/lib/billing/application/authorized-billing-read-use-case.ts | Centralizes billing-read scope resolution and workspace authorization for both billing endpoints. |
| apps/sim/lib/credentials/application/list-workspace-credentials.ts | Moves credential visibility and workspace access enforcement into a Principal-backed application use case. |
| apps/sim/lib/logs/api/route-policies.ts | Defines shared route policies used by the migrated public log endpoints. |
| apps/sim/lib/workspaces/application/workspace-context.ts | Establishes shared Principal-aware workspace context and concealment behavior for public workspace reads. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Request[API request] --> Builder[Internal or v2 JSON route builder]
Builder --> Wrapper[withRouteHandler lifecycle]
Wrapper --> Auth[Authenticate Principal]
Auth --> Policy[Rate and operation policies]
Policy --> Contract[Parse route contract]
Contract --> UseCase[Principal-backed application use case]
UseCase --> Authorization[Workspace or organization authorization]
Authorization --> Read[Domain read]
Read --> Presenter[Preserve route response envelope]
Reviews (2): Last reviewed commit: "improvement(api): migrate policy-sensiti..." | Re-trigger Greptile
|
@cursor review |
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 a6eba68. Configure here.
Summary
Type of Change
Testing
Checklist