Skip to content

fix(credentials): apply credential membership to single-credential lookups - #10317

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/credential-lookup-membership
Nov 22, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/credential-lookup-membership

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • GET /api/auth/oauth/credentials?credentialId skipped the credential-membership check whenever a workflowId was 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; a workflowId still pins the credential's workspace as an extra constraint
  • GET /api/credentials?workspaceId&credentialId resolved 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 as null, same as an unknown id
  • No token material was exposed on either path; this closes the metadata disclosure

Type of Change

  • Bug fix

Testing

  • New lib/credentials/application/single-credential-lookup.integration.ts against 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 controls
  • Red/green: reverting the route fix fails exactly the 2 pinned-workflow cases; reverting the use-case fix fails exactly the 3 lookup cases; all 9 pass with the fix
  • Existing route.test.ts, crud.test.ts, app/api/credentials tests pass (41); biome; pre-push affected type-check

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…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
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 22, 2026 8:38pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The PR applies credential membership and list visibility rules to single-credential lookups.

  • OAuth lookups check credential access even when a workflow is supplied.
  • Internal credential lookups follow the same visibility rules as lists.

Reviews (2) · Last reviewed commit: "fix(credentials): answer unsupported cre..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 5aa429e into staging Nov 22, 2026
84 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/credential-lookup-membership branch November 23, 2026 00:04

This branch was previously deployed

1 inactive deployment
Preview — d26402b0 Deployed Nov 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant