refactor(credentials): drop the principal abstraction, keep the identity fixes - #6207
refactor(credentials): drop the principal abstraction, keep the identity fixes#6207waleedlatif1 wants to merge 1 commit into
Conversation
…ity fixes #6201 introduced a ServiceAccountPrincipal union mirrored centrally into audit and blob metadata, and replaced 21 provider-named audit keys with uniform ones. Nothing reads any of it. It was built for an identity UI that was deliberately not shipped, and the audit-key rename is a breaking change for anything consuming those rows. The gap it was meant to close needed a fraction of that: Atlassian already resolved its accountId, it just was not recorded where every other provider records its identifier. Removes principal.ts, the required-nullable field on all three registry result types, and the central mirroring. Restores the per-provider audit keys, so the only breaking change in #6201 is undone. 14 validators, both registry server.ts files, errors.ts, Zoom, Zoho Desk and 12 test files are byte-identical to main again — each verified as a pure principal swap with no fix inside. Keeps every bug fix: atlassianAccountId + email, googleClientEmail/projectId and slackBotUserId now land in auditMetadata alongside the existing keys; Box and Salesforce log identity-lookup failures (neither file had a logger, so a degraded connect left no trace); Shopify no longer rejects a working credential on a partial-scope error; Google/Slack rotation still re-labels and records the new identity. Also drops providerFailureReason, which became dead code once the minters were rebuilt on main's shape.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Client-credential minters (Box, Salesforce, Zoom, Zoho Desk) drop user/tenant principals and Token validators across Airtable, Asana, Attio, HubSpot, Shopify, etc. follow the same pattern: user/workspace IDs live in named audit keys (e.g. Bespoke builders (Atlassian, Google, Slack) record Reviewed by Cursor Bugbot for commit d9d55c2. Configure here. |
Greptile SummaryThe PR removes the unused service-account principal abstraction while restoring provider-specific identity metadata and retaining targeted credential-validation improvements.
Confidence Score: 5/5The PR appears safe to merge with no concrete production regressions identified. Provider-specific metadata contracts are restored, existing credential consumers remain satisfied, creation and rotation share consistent metadata behavior, and the investigated security and validation paths do not expose reachable failures.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/credentials/service-account-secret.ts | Removes central principal mirroring and emits provider-specific audit metadata while preserving existing credential blob contracts. |
| apps/sim/lib/credentials/token-service-accounts/server.ts | Restores the validation-result interface to provider-owned audit and stored metadata. |
| apps/sim/lib/credentials/client-credential-accounts/server.ts | Removes the required principal field from client-credential identity results. |
| apps/sim/lib/credentials/client-credential-accounts/minters/box.ts | Records the Box service-account login when available and logs best-effort identity lookup failures. |
| apps/sim/lib/credentials/client-credential-accounts/minters/salesforce.ts | Records the Salesforce run-as username and organization while retaining fallback identity behavior. |
| apps/sim/lib/credentials/token-service-accounts/validators/shopify.ts | Maintains strict rejection of errored Shopify responses while distinguishing credential failures from provider failures. |
Reviews (1): Last reviewed commit: "refactor(credentials): drop the principa..." | Re-trigger Greptile
Summary
ServiceAccountPrincipalunion mirrored centrally into audit + blob metadata, and replaced 21 provider-named audit keys with uniformprincipalId/principalKind/principalLabel. Nothing reads any of it. It was built for an identity UI that was deliberately not shipped, and the key rename is a breaking change for anything consuming those audit rowsaccountIdat connect time, it just wasn't recorded where every other provider records its identifierprincipal.ts, the required-nullable field on all three registry result types, and the central mirroring. Restores the per-provider audit keys, so fix(credentials): capture the correct provider identity on connect and rotate #6201's only breaking change is undoneWhat's byte-identical to
mainagain14 validators, both registry
server.tsfiles,errors.ts, Zoom, Zoho Desk, and 12 test files. I diffed each one first to confirm it was a pure principal swap with no fix hidden inside, rather than assuming.Bug fixes kept
atlassianAccountId+atlassianAccountEmailinauditMetadata(the customer's actual gap);emailAddressno longer discardedgoogleClientEmail,googleProjectId,slackBotUserId, alongside the existing keysACCESS_DENIEDalongside a populatedshopno longer rejects a working credential. Test re-added sincemaindoesn't have itproviderFailureReason, which became dead code once the minters were rebuilt onmain's shapeType of Change
Testing
9,440 tests pass across the affected surface. Typecheck, biome,
lint:check,check:api-validation:strict,check:utilsandcheck:boundariesall clean. Zeroprincipalreferences remain outside unrelated AWS IAM code.Not live-tested against real provider accounts — unchanged from #6201, and none of the kept fixes alter a provider request.
Checklist