Repository navigation
fix(credentials): apply credential membership to single-credential lookups - #10317
Conversation
…okups GET /api/auth/oauth/credentials?credentialId skipped the membership check whenever a workflowId was supplied, and GET /api/credentials?credentialId resolved on workspace scope alone. A workspace reader who is not a member of a credential could read its display name, provider, and scopes, which the list forms of both endpoints hide. - the OAuth lookup checks canUseCredential on every request; a workflowId still pins the credential's workspace as an extra constraint - the internal lookup filters its result through the list mode's own visibility rule (listVisibleWorkspaceCredentials + gated service-account filter), so a credential hidden from the list reads as absent
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge. SummaryThe PR applies credential membership and list visibility rules to single-credential lookups.
Reviews (2) · Last reviewed commit: "fix(credentials): answer unsupported cre..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 3 files
This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
GET /api/auth/oauth/credentials?credentialIdskipped the credential-membership check whenever aworkflowIdwas supplied, so a workspace reader who isn't a member of a credential could read its display name, provider, and granted scopes. The membership check (canUseCredential) now runs on every lookup; aworkflowIdstill pins the credential's workspace as an extra constraintGET /api/credentials?workspaceId&credentialIdresolved on workspace scope alone. The lookup now filters through the list mode's own visibility rule (listVisibleWorkspaceCredentials+ the gated service-account filter), so a credential hidden from the list — including another user's personal env var — reads asnull, same as an unknown idType of Change
Testing
lib/credentials/application/single-credential-lookup.integration.tsagainst real Postgres: non-member refused with a pinned workflow (OAuth + service account), non-member lookup by id / legacy account id reads null, another user's personal env var hidden even from a workspace admin, plus member and workspace-admin positive controlsroute.test.ts,crud.test.ts,app/api/credentialstests pass (41); biome; pre-push affected type-checkChecklist
test-auditauthoring gate)