Repository navigation
fix(actions): gate execute_script nodes behind a global trust level (WI-2360) - #564
Closed
stefan-ernst wants to merge 1 commit into
Closed
stefan-ernst wants to merge 1 commit into
stefan-ernst wants to merge 1 commit into
Conversation
…WI-2360) Sobek runs action scripts in-process without a per-script heap bound, so action.manage alone let any authenticated user (including a self-registered one in a personal workspace) save and run an unbounded allocation that drove the whole process into the memory-limit GC death spiral. Add the global action.execute_script permission and require it, in addition to action.manage, to persist a graph containing an execute_script node or to manually run an action that has one. Metadata-only edits that leave the graph untouched stay available to action managers, and triggered executions keep running existing definitions. Denials write the existing access-denied audit row with the required permission. Compiled-in action templates must not ship execute_script nodes, since an applier cannot hold the per-user trust level; ApplyToWorkspace now refuses them. Surface the restriction in the execute_script catalog description (UI and v2 OpenAPI catalog), the script config panel, the admin permission list, and the operator-controls README. Process isolation remains the prerequisite before accepting untrusted authors; this is the interim trust gate from the item.
|
Size Change: 0 B 🆕 Total Size: 0 B |
Contributor
Author
|
Closing: this implements the item's interim option 2 (global trust gate), which is a product regression rather than the intended fix. Replacing it with option 1: a memory-bounded worker process. |
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.
Problem
execute_scriptruns author-supplied JavaScript in Sobek inside the APIprocess. CPU is bounded (
vm.Interrupt, 30 s cap) and source is capped at10 KB, but nothing bounds allocation. Any holder of
action.manage— and, perthe item's follow-up, every authenticated user in their personal workspace —
could save and trigger an action that allocates without bound and drive the
whole instance into the
debug.SetMemoryLimitGC death spiral. Availabilityimpact across tenants.
Fix (item option 2)
Process isolation (option 1) is a larger worker design. This PR takes the
item's sanctioned interim path: stop treating
action.manageas sufficientfor executable nodes.
action.execute_scriptpermission (system admins hold itimplicitly; it is not granted to workspace roles).
execute_scriptnode now requiresit, in addition to
action.manage. Metadata-only edits that leave the graphuntouched stay available to action managers.
execute_scriptnode requiresit as well.
required_permission = action.execute_script.execute_scriptnodes (theapplier cannot hold a per-user trust level);
ApplyToWorkspacerefuses them.execute_scriptcatalog description (UI andthe v2 OpenAPI catalog), the script config panel (warning for users without
the permission), the admin permission list, and the operator-controls README.
Enforcement is centralised in
ActionDefinitionService(injectedPermissionService), so v1, v2, and the AI/MCP tool paths are all covered.Triggered executions of already-saved definitions keep running; the README
tells operators to remove or rewrite them before revoking the permission.
Acceptance criteria
1–3 (isolation, RSS bound, other tenants unaffected, budgets in an isolated
runtime): not addressed — they require option 1, which this item lists as
the preferred but larger design. They remain the follow-up.
4 (denial coverage for save and execute): met and tested.
5 (REST bridge semantics unchanged): met — no bridge, scope, redirect, or path
logic changed; the executor and dispatcher are untouched.
Testing
(Windshiftapp/core-tests-internal#72): create/update denial + audit,
metadata-only edit allowed, manual-execute denial + audit, template refusal.
services,aitools,restapi/v2,restapi/v1/handlers, anddatabaseallpassed.
golangci-lint,make openapi-v2-check, and the frontendnpm run check/svelte-checkpass.Note: the black-box
./tests/package does not compile onorigin/mainbecause
tests/request_type_available_fields_test.goreferencesStartIsolatedTestServer, which is not defined in the committed tree. That ispre-existing and unrelated; it was not run.
Schema
Adds
20261204_action_execute_script_permissionso existing databases receivethe new permission row; fresh installs get it from
permissions.sql.