GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(logs): stop requiring a human subject on actorless runs by TheodoreSpeaks · Pull Request #7220 · simstudioai/sim Conversation
|
| Domain | What the userId actually was | Treatment |
|---|---|---|
Logs — read-log-detail, read-execution-snapshot |
Attribution for large-value materialization and secret projection. The read path never writes, so LargeValueStoreContext.userId is already optional and unread. |
Resolved optionally; viewerUserId optional through fetch-log-detail and hydrate-child-traces |
Tables — rows.ts |
A tables-v2-api feature-flag dimension |
Resolved optionally — a missing user resolves the admin clause to false with no query, so the gate only ever narrows |
Credential groups — create-invite-link |
created_by, a nullable on delete set null column |
An actorless run issues an unattributed link rather than being refused. send-invite reuses the subject its own guard already resolved |
MCP — execute-tool, use-cases |
Genuinely load-bearing: the stored credentials presented to a third-party server, plus the permission-group gate | Preserves pre-existing behavior — see below |
This one is a real identity, so it preserves what was already happening rather than changing it. Before these tools moved in-process, the executor minted an internal token from ExecutionContext.userId and the MCP route ran as that user; the intermediate version passed the same value as subjectUserId. An unattended run has therefore always reached MCP as the execution actor.
That value is now passed explicitly as executionActorUserId instead of arriving implicitly, and is documented for what it is: for a schedule, webhook, or anonymous public-API run the actor is the workspace system actor resolved during preprocessing — the billing payer, not the workflow's author. A principal that names its own subject always wins, so this can't be used to nominate someone else's credentials, and it is not an authorization input.
An external_user webhook subject falls back too, deliberately: it is a real identity but never a Sim user, so it has no Sim credentials of its own, and those runs have always connected as the actor. Refusing them would break working workflows over a boundary the old path never drew.
@sim/auth gains resolvePrincipalSubjectUserId, with requirePrincipalSubjectUserId reimplemented on top. The resolve/require pair makes the choice visible at each call site — picking require where resolve was correct is what caused this.identity-faults.ts centralizes the identity-error classification that was copy-pasted across 8 internal tool handlers: PrincipalSubjectUserRequiredError → 403 naming the cause, and a now-typed ExecutorDelegationOriginRequiredError → 401 (it was a bare Error, so a request with no execution context fell through to a generic 500). Each handler keeps its own response envelope.check:actorless-executor-operations audit keeps this class visible instead of waiting on a canary: it resolves operation policies through spreads and same-file factories, fails closed for lib/internal/** and for shared use-case factories in executor-admitting domains, and requires // actorless-unsupported: <reason> on the 14 sites where a person genuinely is required.authType === 'oauth' servers. headers (the DB default) and none need no person unless the config references a personal env var, and resolveMcpConfigEnvVars runs with strict: true so a missing var throws rather than silently sending an empty header.Tested manually. bun run type-check, bun run lint:check, check-block-registry, and bun run check:audits (39/39, including the new audit) all pass. 434 test files / 4807 tests pass across logs, mcp, credential-groups, tables, internal, and auth.
New regression coverage: the actorless path at the readLogDetailUseCase boundary (exercising the real authorization path, not a stub), in hydrateChildTraces, in readLogDetail, for an unattended run and an external-subject webhook reaching MCP as the execution actor, for an authenticated subject taking precedence over it, for the 403 and 401 identity-fault mappings, and fixture-driven tests for the new audit script.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Greptile SummaryThe PR separates optional human attribution from authorization for actorless workflow runs while retaining explicit user requirements for person-scoped operations.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/auth/src/principal.ts | Adds optional subject-user resolution and implements the existing required resolver on top of it. |
| apps/sim/lib/logs/fetch-log-detail.ts | Propagates an optional viewer identity through log materialization and child-trace hydration. |
| apps/sim/lib/logs/execution/hydrate-child-traces.ts | Allows actorless child-trace hydration while retaining workspace and publisher-policy checks. |
| apps/sim/lib/mcp/application/authorization.ts | Resolves MCP’s credential user from the verified principal first and otherwise from the trusted execution actor. |
| apps/sim/lib/internal/tool-operations/identity-faults.ts | Centralizes unauthenticated and missing-human-subject error classification for internal tools. |
| scripts/check-actorless-executor-operations.ts | Adds a static audit requiring executor-admitting operations to resolve identity optionally or document why actorless execution is unsupported. |
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Workflow trigger] --> B[Verified principal]
B --> C{Human subject present?}
C -->|Yes| D[Use subject for attribution]
C -->|No| E[Continue actorless-capable operation]
E --> F[Authorize from deployment delegation]
E --> G[Use trusted execution actor for MCP]
C -->|Required by operation| H[Return explicit identity-required response]
Reviews (3): Last reviewed commit: "fix(mcp): keep unattended runs connectin..." | Re-trigger Greptile
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
All reported issues were addressed across 41 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Scheduled, public-API, and subject-less webhook runs carry no user on their principal. Several use cases resolved one with requirePrincipalSubjectUserId where the user was only attribution, so those runs failed with an opaque 500. Authorization for an actorless caller comes from the workflow running a deployment, never from a userId; each site now treats the user as what it actually is.
c950e05 to
07b7a5c
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Restores the identity MCP used before the Logs and MCP tools moved in-process: the executor minted an internal token from ExecutionContext.userId and the MCP route ran as that user, so a schedule, webhook, or public-API run has always reached MCP as the execution actor. Names it for what it is rather than implying it is the workflow's author, and documents that a workspace-level MCP identity is the real fix. Also types the missing-execution-context error so it is answered as unauthenticated rather than falling through to a generic 500.
07b7a5c to
3125c1f
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
3125c1f8
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.