fix(credential-groups): stop requiring a human subject on workflow ops - #7275
Merged
Merged
Conversation
A Slack-triggered run's subject is the external Slack user, and a schedule or public-API run has no subject at all. list_groups, list_people, and send_invite demanded a Sim user, so every unattended run got "Credential Group user access required" — including reads that need no actor. Authority for an actorless caller comes from the deployment the workspace layer already checks. Invitations no longer name an inviter when there is no person to name, rather than borrowing the run's actor and claiming someone invited when they did not.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR allows deployed workflow operations to run without requiring a Sim-user subject while retaining delegation-subject consistency and existing workspace/resource authorization.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, security, or compatibility defects identified. The relaxed gate retains delegation-subject consistency, workspace and deployment authorization, and credential-group scope checks, while downstream persistence, auditing, email rendering, and enrollment UI safely support missing human attribution.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/credential-groups/application/authorization.ts | Replaces the Sim-user-only workflow gate with validation that the delegation subject remains consistent with its execution principal. |
| apps/sim/lib/credential-groups/application/send-invite.ts | Allows actorless workflow invitations while deriving human attribution only from a verified Sim-user subject. |
| apps/sim/lib/credential-groups/enrollments.ts | Propagates an optional issuer through invitation creation and exposes nullable inviter attribution to the public enrollment page. |
| apps/sim/components/emails/credential-groups/credential-group-invitation-email.tsx | Adds explicit invitation copy for workflow-issued invitations without a named human inviter. |
| apps/sim/app/credential-groups/enroll/[token]/page.tsx | Renders neutral enrollment copy when the invitation has no persisted human issuer. |
| apps/sim/lib/credential-groups/application/send-invite.test.ts | Covers actorless, external-user, human-session, permission failure, fallback identity, and spoofed-subject invitation paths. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Run[Workflow execution] --> Delegation[Executor delegation]
Delegation --> Consistency[Validate delegated subject consistency]
Consistency --> Workspace[Check workspace and deployment authority]
Workspace --> Scope[Check credential-group resource scope]
Scope --> Operation[List groups, list people, or send invite]
Operation --> Attribution{Sim user actor?}
Attribution -->|Yes| Human[Load inviter identity]
Attribution -->|No| Actorless[Use no human inviter]
Human --> Invitation[Issue invitation]
Actorless --> Invitation
Invitation --> Email[Render actor-aware email copy]
Invitation --> Audit[Record workflow execution attribution]
Reviews (1): Last reviewed commit: "fix(credential-groups): stop requiring a..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
list_groups,list_people, andsend_inviterequired a Sim user subject, so every unattended run failed withCredential Group user access required— a Slack-triggered run's subject is the external Slack user, and a schedule or public-API run has no subject at allrequireCredentialGroupWorkflowActor, which keeps the assert that a delegation's subject matches the run it was minted for but no longer demands a Sim user. Authority for an actorless caller is unchanged: executor delegation, matching workspace, in-scope resource, deployment-mode current workflowget_invite_linkalready had no such check, so the four workflow-facing ops are now consistentinviterNameis optional throughsend-invite→enrollments→ email render → subject line, and the copy branches:You have been invited to connect accounts for <workspace> on Sim<recipient> has been invited to connect accounts for …'A workspace admin'fallback on the enrollment landing page;PublicCredentialGroupEnrollment.inviterNameis now nullable and the page reads "You have been invited to connect accounts for ."Type of Change
Testing
New
send-invite.test.tscovers Slack-triggered, actorless schedule, session-actor, email-fallback, admin-permission, and spoofed-subject cases; addedrequireCredentialGroupWorkflowActorcoverage toauthorization.test.ts. Credential-groups, email, and enrollment-surface suites pass (241 tests).bun run type-check,bun run lint,bun run check:audits(39/39), and the block-registry audit all pass.Checklist