fix(credentials): workspace admin users get 'member' role on credential_member instead of 'admin'
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #5431 by @tsushanth — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- api, authorization, backend
Research direction
Start with ensureWorkspaceCredentialMemberships in apps/sim/lib/credentials/environment.ts and the POST handler in apps/sim/app/api/credentials/route.ts; trace how workspace permissions are read and how credential_member roles are assigned. Reproduce the owner, admin, write, and read cases, then verify that owner and admin users receive admin while write and read users receive member.
Written by the indexing model from the issue text.
Description
Bug Description
When a workspace-scoped secret is created (via Settings > Secrets or syncWorkspaceEnvCredentials), the credential_member role is determined solely by whether the user is the workspace owner:
const targetRole = memberUserId === ownerUserId ? 'admin' : 'member'
This means workspace admin users are assigned member role on credential_member, making them unable to edit or delete the secret — even though they have admin access to the workspace.
Affected Code
apps/sim/lib/credentials/environment.ts—ensureWorkspaceCredentialMemberships: only checksownerUserId, ignores workspacepermissionstableapps/sim/app/api/credentials/route.ts— POST handler: same issue, onlyworkspaceRow.ownerId || session.user.idgets admin
Expected Behavior
Credential member role should reflect workspace permissions:
| Workspace Permission | Credential Role |
|---|---|
owner (workspace.ownerId) |
admin |
| admin (permissions table) | admin |
| write | member |
| read | member |
Steps to Reproduce
- Create a workspace with multiple members (owner + admin + write/read users)
- As the owner, go to Settings > Secrets and create a workspace-scoped secret
- Check
credential_membertable — only the owner hasadminrole - Log in as a workspace admin user — cannot edit or delete the secret
- Dominant language
- TypeScript
- Stars
- 29.8k
- Forks
- 3.9k
- Avg merge
- 1h 43m
- Merged PRs (30d)
- 937
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from simstudioai/sim
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
simstudioai/sim#10710 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
simstudioai/sim#10708 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
simstudioai/sim#10706 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
simstudioai/sim#10704 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
simstudioai/sim#10702 ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
melgarafael/DeskcommCRM#5614 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 76/100
slackapi/slack-health-score#253 ·
Maintainers usually reply within 1 day
-
feature needs triage site
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
owid/owid-grapher#8019 ·
Maintainers usually reply within 1 day
-
via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug:new
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
callstackincubator/simlock#2088 ·
Maintainers usually reply within 1 day