Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AIPexStudio AIPex Sandboxed Code Execution

From Leeroopedia
Knowledge Sources
Domains Security, Code_Sandboxing
Last Updated 2026-10-24 12:00 GMT

Overview

A security pattern that executes untrusted code inside an isolated WebAssembly-based JavaScript VM with a controlled API surface, preventing access to the host environment.

Description

Sandboxed Code Execution addresses the fundamental challenge of running user-supplied or third-party scripts safely. QuickJS (compiled to WebAssembly) provides a complete JavaScript runtime that is isolated from the browser's main context—it has no access to `window`, `document`, `chrome`, or any host API unless explicitly injected. The host creates a VM context, injects a controlled API bridge (file system, console, fetch, tool registration), and executes the code. Memory limits, stack sizes, and execution timeouts enforce resource bounds. This allows skill scripts to run arbitrary JavaScript logic without risking the extension's security.

Usage

Use this principle when an extension or application needs to execute user-provided or third-party code safely. It is essential for plugin systems, skill marketplaces, or any scenario where untrusted code must run in a browser context.

Theoretical Basis

Host:
  1. Initialize QuickJS runtime (WASM, sync variant for CSP)
  2. Create VM context
  3. Inject global APIs: SKILL_API, fs, console, fetch, registerTool
  4. Inject args variable
  5. evalCode(skillScript) with module type
  6. Execute pending jobs until main() resolves or timeout (60s)

Constraints:
  Memory: 100MB limit
  Stack: 1MB
  Timeout: 60 seconds
  No asyncify (CSP restriction in Chrome extensions)

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment