fix(execution): resolve secrets against the acting principal, not the workflow owner - #6690
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryHigh Risk Overview Workspace secrets are loaded with credential membership for the execution actor ( Adds Path consistency: Docs ( Reviewed by Cursor Bugbot for commit 3c4dd6b. Configure here. |
Greptile SummaryThe PR separates personal-secret ownership from workspace-secret authorization so execution environments resolve against the appropriate principal across synchronous, streaming, queued, and resumed runs.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/environment/utils.ts | Introduces split-principal environment resolution and narrows the owner fallback to an explicit workspace-access denial. |
| apps/sim/lib/workflows/executor/execution-core.ts | Selects personal and workspace environment identities from execution metadata and applies the combined environment snapshot. |
| apps/sim/app/api/workflows/[id]/execute/route.ts | Propagates caller-authorization and anonymous-public-API decisions consistently across sync, stream, and async execution. |
| apps/sim/background/workflow-execution.ts | Preserves identity decisions in queued execution payloads so workers resolve secrets consistently with request-bound paths. |
| apps/sim/executor/execution/snapshot-serializer.ts | Persists both identity flags across human-in-the-loop pause and resume. |
| packages/testing/src/mocks/environment-utils.mock.ts | Recomputes conflict and decryption-failure metadata from the retained personal and workspace slices, addressing the previous mock-divergence finding. |
| packages/db/schema.ts | Adds documentation clarifying that workflow ownership is not generally an execution identity; no database shape changes are introduced. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Trigger[Execution trigger] --> Identity{Identifiable caller?}
Identity -->|Yes| Caller[Caller identity]
Identity -->|No| Billing[Workspace billing account]
Caller --> Personal[Resolve personal secrets as caller]
Caller --> Workspace[Authorize workspace secrets as caller]
Billing --> Public{Anonymous public API?}
Public -->|Yes| NoPersonal[No personal-secret slice]
Public -->|No| Owner[Resolve personal secrets as workflow owner]
Billing --> WorkspaceBilling[Authorize workspace secrets as billing account]
WorkspaceBilling --> Access{Workspace access?}
Access -->|Yes| Merge[Merge personal and workspace slices]
Access -->|No| OwnerFallback[Resolve both slices as workflow owner]
Personal --> Merge
Workspace --> Merge
NoPersonal --> Merge
Owner --> Merge
OwnerFallback --> Merge
Reviews (2): Last reviewed commit: "fix(execution): propagate run identity a..." | Re-trigger Greptile
…e public runs to workspace secrets
|
@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 3c4dd6b. Configure here.
Summary
getExecutionEnvironment, which resolves the two slices from their own identities and collapses to the single existing query when they match. If the billing account can no longer reach the workspace (billedAccountUserIdis a stored column, so an org ownership transfer can strand it), it falls back to the owner and logs rather than failing every background runenforceCredentialAccessandisPublicApiAccessthrough the streaming execution path andexecuteWorkflowService, which build their own metadata and would otherwise disagree with the JSON path and with v2workflow.userIddeprecated as an execution identity in the schema, documenting the one fallback that remains. It stays the ownership column everywhere elseIntentional behavior changes: runs with an identifiable caller no longer resolve workspace secrets the caller lacks credential membership for, nor personal secrets that exist only in the owner's namespace; anonymous public-API runs no longer resolve the owner's personal vars.
Type of Change
Testing
Tested manually.
type-checkclean; 4,500 tests acrosslib/workflows,lib/environment,lib/execution,lib/copilot,app/api/workflows, andapp/api/v2;lint; block-registry check; all 26 audits viacheck:audits.check:migrationsreports no new migrations — the schema change is comment-only.Checklist