feat(secrets): allow admins to view and edit workspace secret values#4040
feat(secrets): allow admins to view and edit workspace secret values#4040waleedlatif1 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview This derives Reviewed by Cursor Bugbot for commit 72d4e72. Configure here. |
Greptile SummaryThis PR adds workspace-admin permission gating to the workspace secrets management UI, allowing admins to reveal, rename, edit, and delete workspace secrets while non-admins see only masked values and no edit/delete controls. The Key findings:
Confidence Score: 3/5Not safe to merge as-is — the non-admin value masking is purely cosmetic because the server returns decrypted secrets to all workspace members. The P1 finding directly contradicts the PR's stated goal of restricting secret visibility to admins. The API write-path is correctly protected, so there is no data-corruption risk, but the confidentiality guarantee is broken. Both credentials-manager.tsx and apps/sim/app/api/workspaces/[id]/environment/route.ts need attention.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/settings/components/credentials/credentials-manager.tsx | Adds workspace-admin permission gating to secret editing UI; non-admin masking is cosmetic only since the backend GET returns decrypted values to all members. |
Sequence Diagram
sequenceDiagram
participant Browser
participant Frontend as CredentialsManager
participant PermAPI as GET /workspaces/[id]/permissions
participant EnvAPI as GET /workspaces/[id]/environment
Browser->>Frontend: Page load
Frontend->>PermAPI: useWorkspacePermissionsQuery
PermAPI-->>Frontend: users with permissionType
Frontend->>EnvAPI: useWorkspaceEnvironment
EnvAPI-->>Frontend: DECRYPTED_VALUES for all members
Note over Frontend: isWorkspaceAdmin = permissionType === admin
alt Admin user
Frontend->>Browser: Editable inputs plus delete buttons
Note over Browser: Masked until focused (WebKit only)
else Non-admin user
Frontend->>Browser: Read-only inputs, no delete buttons
Note over Browser: Cosmetic masking only, values in network response
end
Comments Outside Diff (2)
-
apps/sim/app/workspace/[workspaceId]/settings/components/credentials/credentials-manager.tsx, line 329-334 (link)Server-side data leaks workspace secrets to non-admins
isWorkspaceAdmincorrectly restricts the editing UI to workspace admins, but the backendGET /api/workspaces/[id]/environmentreturns fully decrypted workspace variables to every workspace member (anypermissionType). TheworkspaceVarsstate is therefore populated with plaintext secret values for non-admins too — the bullet-character masking at line 179 is purely cosmetic. Any non-admin can read the actual values by:- Opening DevTools → Network → inspecting the
GET .../environmentresponse - Querying the TanStack Query cache in the browser console
If the intent is to truly restrict secret visibility to admins, the
GEThandler needs to either return masked values or only return the full set to admin-permissioned users. - Opening DevTools → Network → inspecting the
-
apps/sim/app/workspace/[workspaceId]/settings/components/credentials/credentials-manager.tsx, line 329-334 (link)Client-side admin check is more restrictive than the server
isWorkspaceAdminrequirespermissionType === 'admin', but thePUTandDELETEhandlers inapps/sim/app/api/workspaces/[id]/environment/route.ts(lines 88 and 174) allowadminORwriteusers to mutate workspace environment variables. This means a user withwritepermission is silently blocked by the UI even though the API would accept their request.If the intent is to limit workspace-secret editing to
adminonly, the server-side check should also be tightened to match.
Reviews (1): Last reviewed commit: "feat(secrets): allow admins to view and ..." | Re-trigger Greptile
apps/sim/app/workspace/[workspaceId]/settings/components/credentials/credentials-manager.tsx
Outdated
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/settings/components/credentials/credentials-manager.tsx
Show resolved
Hide resolved
|
@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 72d4e72. Configure here.
Summary
Type of Change
Testing
Tested manually
Checklist