Execution Engine & Deno Sandbox
Relevant source files
The following files were used as context for generating this wiki page:
The Execution Engine manages the deterministic lifecycle of multi-step workflows known as "tools." It isolates these executions within a secure Deno sandbox to ensure that user-provided transformations, data selectors, and API calls cannot compromise the host system.
The engine translates high-level tool configurations into atomic operations, including HTTP requests, database queries, and file manipulations. It uses a MessagePack-based IPC (Inter-Process Communication) mechanism to communicate between the Node.js host and the Deno subprocess.
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:3-5, packages/core/deno-runtime/workflow-executor.ts:14-25
Core Architecture
The system follows a worker-based model where each workflow run spawns or utilizes a DenoWorker. This worker manages a standalone Deno process with restricted permissions.
Component Overview
| Component | Responsibility |
|---|---|
| DenoWorker | Manages the lifecycle of a single Deno subprocess, including spawning, stdin/stdout communication, and killing the process. |
| WorkflowExecutor | The entry point inside the Deno runtime. It parses the payload, iterates through steps, and routes to protocol strategies. |
| IPC Layer | Encodes payloads and decodes results using MessagePack for efficient communication via standard I/O streams. |
| Protocol Strategies | Specific handlers for different execution targets like HTTP, PostgreSQL, MSSQL, Redis, FTP, and SMB. |
Sources: packages/core/deno/deno-worker.ts:16-30, packages/core/deno-runtime/workflow-executor.ts:60-70, packages/web/src/lib/agent/skills/content/superglue-concepts.md:46-54
Execution Flow Diagram
The following diagram illustrates the lifecycle of a tool execution from the host to the sandbox.
Security and Sandboxing
Security is enforced through Deno's native permission flags and custom fetch overrides to prevent Server-Side Request Forgery (SSRF).
Sandbox Constraints
The DenoWorker spawns the subprocess with the following restricted environment:
- Networking: Restricted via
--allow-net. Well-known cloud metadata endpoints (e.g.,169.254.169.254) are explicitly denied via--deny-net. - Filesystem: Completely blocked using
--deny-readand--deny-write. - Subprocesses: Execution of other binaries is blocked with
--deny-run. - Environment: Limited access via
--allow-env, primarily for standard Deno/Node environment variables. - Memory: Capped via the
memoryMboption using the--v8-flags=--max-old-space-sizeflag.
Sources: packages/core/deno/deno-worker.ts:65-90, packages/core/deno/deno-worker.test.ts:75-125
SSRF Protection
The execution engine implements a defense-in-depth approach to SSRF:
- Deno Flag Layer: Hard-coded list of metadata hosts (AWS, GCP, Azure, Alibaba) is passed to
--deny-net. - Runtime Layer: If the
BLOCK_LOCAL_REQUESTSenvironment variable is set to"true", the internal fetch implementation blocks loopback (127.0.0.1) and private RFC1918 IP ranges. - Tunnel Exception: Tunneled requests (e.g., to local databases) are permitted via an allowlist of specific ports mapped during execution.
Sources: packages/core/deno/deno-worker.ts:18-28, packages/core/deno-runtime/workflow-executor.ts:315-320, packages/core/deno/deno-worker.test.ts:300-350
Step Execution Logic
A tool consists of multiple steps executed sequentially. Each step produces a result that becomes available to subsequent steps in the sourceData object.
Data Selection and Looping
Steps use a dataSelector to determine their execution mode.
- Single Mode: If the selector returns an object, the step executes once.
- Loop Mode: If the selector returns an array, the step executes once per item. The engine sets
currentItemfor each iteration.
Sources: packages/web/src/lib/agent/skills/content/data-handling.md:95-120, packages/core/deno-runtime/workflow-executor.ts:260-310
Variable Resolution
The engine resolves dynamic values wrapped in << >> syntax before execution. It merges several data sources into a single context:
- originalPayload: User-provided inputs.
- previousStepResults: Data from completed steps, keyed by step ID.
- systemCredentials: Namespaced as
<<systemId_key>>. - systemUrls: Namespaced as
<<systemId_url>>.
Sources: packages/web/src/lib/agent/skills/content/data-handling.md:33-50, packages/core/deno-runtime/workflow-executor.ts:145-165
Strategy Routing
The WorkflowExecutor routes request configurations to strategies based on the protocol scheme in the URL.
| Protocol | Strategy |
|---|---|
http://, https:// | HTTP Strategy |
postgres://, postgresql:// | PostgreSQL Strategy |
mssql://, sqlserver:// | MSSQL Strategy |
redis://, rediss:// | Redis Strategy |
ftp://, sftp://, smb:// | File Server Strategy |
Sources: packages/core/deno-runtime/workflow-executor.ts:100-120, packages/web/src/lib/agent/skills/content/superglue-concepts.md:46-54
Error Handling and Timeouts
The engine implements multiple layers of safety to prevent runaway processes.
| Timeout Type | Default Value | Description |
|---|---|---|
TRANSFORM_TIMEOUT_MS | 10 minutes | Maximum time for a JS transformation step. |
STEP_TIMEOUT_MS | 1 hour | Maximum duration for a single request step. |
WORKFLOW_TIMEOUT_MS | 10 hours | Overall limit for the entire worker execution. |
HTTP_DEFAULT_TIMEOUT | 1 hour | Default timeout for individual HTTP requests. |
Sources: packages/core/deno-runtime/types.ts:175-185, packages/core/deno/deno-worker.ts:110-120
If a step fails, the engine checks the failureBehavior property:
- "fail" (Default): The entire workflow stops immediately and returns an error result.
- "continue": The engine records the error but proceeds to the next step.
Sources: packages/core/deno-runtime/types.ts:53, packages/core/deno-runtime/workflow-executor.ts:348-360
Conclusion
The Execution Engine & Deno Sandbox provides a robust and secure environment for running arbitrary integration logic. By combining strict OS-level process isolation with protocol-aware execution strategies, superglue ensures that multi-step workflows are deterministic, scalable, and safe from common security vulnerabilities like SSRF and resource exhaustion.