Skip to content

fix(credentials): conceal inaccessible credential reads - #6730

Merged
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/credential-rbac-concealment
Aug 15, 2026
Merged

fix(credentials): conceal inaccessible credential reads#6730
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/credential-rbac-concealment

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • restore the generic forbidden response for workspace writers without credential access
  • add application and route regression coverage

Type of Change

  • Bug fix

Testing

Passed 501 credential tests, Sim/Auth type-check, full lint, block-registry audit, and all 26 repository audits.

Checklist

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

@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 15, 2026 8:40am

Request Review

@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Authorization and API error-mapping change with narrow scope; tests lock in the intended concealment behavior.

Overview
Fixes GET /api/credentials/[id] so workspace writers who are not credential members get a generic 403 { error: 'Forbidden' }, instead of exposing a credential-specific denial message.

Member-level authorization now raises a dedicated CredentialAccessRequiredError, and the credential detail route uses internalCredentialDetailErrorPolicy to map that error to the generic forbidden response. PUT/DELETE keep the existing error policy.

Regression tests cover the authorized use case (deny without membership) and the route handler response shape.

Reviewed by Cursor Bugbot for commit 4a72dcb. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR restores a concealed forbidden response when workspace writers attempt to read credentials they cannot access.

  • Introduces a credential-specific access-denial error.
  • Maps that denial to a generic 403 response on the credential-detail route.
  • Adds use-case and route-level regression coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/credentials/application/authorized-credential-use-case.ts Introduces a classified error for member-level credential-access denials without changing the authorization decision.
apps/sim/lib/credentials/api/route-policies.ts Adds a detail-route policy that conceals the credential-access denial behind a generic forbidden response.
apps/sim/app/api/credentials/[id]/route.ts Applies the specialized error policy to the credential-detail GET endpoint.
apps/sim/lib/credentials/application/authorized-credential-use-case.test.ts Verifies that writers lacking credential membership are denied before the protected operation executes.
apps/sim/app/api/credentials/[id]/route.test.ts Verifies that the credential-detail route returns a generic 403 response for the new denial type.

Sequence Diagram

sequenceDiagram
  participant Writer as Workspace writer
  participant Route as GET /api/credentials/[id]
  participant UseCase as Credential read use case
  participant Policy as Detail error policy
  Writer->>Route: Request inaccessible credential
  Route->>UseCase: Execute credential read
  UseCase-->>Route: CredentialAccessRequiredError
  Route->>Policy: Project application error
  Policy-->>Writer: "403 {"error":"Forbidden"}"
Loading

Reviews (2): Last reviewed commit: "fix(credentials): conceal inaccessible c..." | Re-trigger Greptile

@TheodoreSpeaks
TheodoreSpeaks force-pushed the fix/credential-rbac-concealment branch from de27b43 to 4a72dcb Compare August 15, 2026 08:40
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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 4a72dcb. Configure here.

@TheodoreSpeaks
TheodoreSpeaks merged commit c269e88 into staging Aug 15, 2026
30 checks passed
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