feat(byok): support multiple keys per provider with round-robin rotation#4963
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
PR SummaryHigh Risk Overview Runtime: API: GET returns every key with UI: Workspace BYOK settings use multi-key mode—per-provider Manage modal, named keys, per-key update/delete—while the enterprise mothership tab keeps single-key behavior on the shared Unit tests cover route semantics and rotation behavior. Reviewed by Cursor Bugbot for commit 3f6e3e7. Configure here. |
Greptile SummaryThis PR upgrades workspace BYOK from one key per provider to a pool of up to 10 keys per provider, with round-robin rotation handled entirely in-process inside
Confidence Score: 5/5Safe to merge — cap enforcement, rotation logic, and all three route verbs are covered by 24 unit tests, the advisory-lock pattern mirrors existing workspace-env code, and the migration requires no backfill. All changed paths are well-tested: rotation cycle, per-provider cursor independence, decrypt-failure fallback, and route semantics are each exercised. The concurrent-insert race addressed in previous review iterations is correctly closed with the transaction + advisory lock. The migration correctly replaces the dropped onConflictDoNothing target with an application-level idempotency guard. No unguarded cross-workspace data access or missing validation was found. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "fix(byok): drop ON CONFLICT on removed u..." | Re-trigger Greptile |
476d1d9 to
a27cc9c
Compare
|
@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 a27cc9c. Configure here.
|
@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 3f6e3e7. Configure here.
…ap hint in manage modal
Summary
(workspace_id, provider_id)unique index, added a plain composite lookup index and a nullablenamelabel column — existing rows need no backfillgetBYOKKey(in-process cursor, decrypt-failure skips to the next key), so all call sites are untouched/api/workspaces/[id]/byok-keystake an optionalkeyId: with it they update/delete that key, without it they keep the old add / delete-all-for-provider semanticsType of Change
Testing
Added unit tests for rotation (cycle order, per-provider cursors, decrypt fallback) and route semantics (add vs update-by-keyId, cap, delete one/all, authz) — 24 tests passing. Typecheck and
check:api-validationpass.Checklist