fix(credentials): workspace admin users get 'member' role on credential_member instead of 'admin'

Offen
#4,698 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

  • #5431 von @tsushanth — ohne Merge geschlossen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
42/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
typescript

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

  1. apps/sim/lib/credentials/environment.ts — ensureWorkspaceCredentialMemberships: only checks ownerUserId, ignores workspace permissions table
  2. apps/sim/app/api/credentials/route.ts — POST handler: same issue, only workspaceRow.ownerId || session.user.id gets 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

  1. Create a workspace with multiple members (owner + admin + write/read users)
  2. As the owner, go to Settings > Secrets and create a workspace-scoped secret
  3. Check credential_member table — only the owner has admin role
  4. Log in as a workspace admin user — cannot edit or delete the secret
Vorherrschende Sprache
TypeScript
Sterne
29.8k
Forks
3.9k
Ø Merge
1 Std. 44 Min.
Gemergte PRs (30 T.)
841

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus simstudioai/sim

Alle Issues in simstudioai/sim

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.