OC-301e · Module 1
Sandboxed Execution
3 min read
A plugin runs third-party code inside your framework. Without sandboxing, that code has access to everything the framework has access to — memory, file system, network, other plugins' state. A buggy plugin crashes the framework. A malicious plugin exfiltrates data. Sandboxing limits what a plugin can do by running it in an isolated environment with constrained permissions.
The sandbox provides three isolation boundaries. Resource isolation: each plugin gets a defined allocation of CPU time, memory, and network bandwidth. Exceeding the allocation triggers throttling or termination, not framework instability. State isolation: each plugin has its own storage namespace. It cannot read or write other plugins' state. Framework state is accessible only through the extension point API, never through direct access. Permission isolation: each plugin declares its required permissions in its manifest — network access, file system read, file system write, inter-plugin communication. The framework grants only declared permissions. Undeclared access attempts are blocked and logged.
interface PluginManifest {
name: string;
version: string;
description: string;
author: string;
extensionPoints: {
hooks?: string[]; // e.g., ['pre-execute', 'post-output']
providers?: string[]; // e.g., ['storage']
transformers?: string[]; // e.g., ['output']
listeners?: string[]; // e.g., ['task.complete']
};
permissions: {
network?: boolean; // can make HTTP requests
fileRead?: string[]; // allowed read paths
fileWrite?: string[]; // allowed write paths
interPlugin?: string[]; // plugins it can communicate with
};
resources: {
maxMemoryMB: number; // memory ceiling
maxCpuMs: number; // CPU time per execution
timeoutMs: number; // maximum execution duration
};
}