File size: 835 Bytes
6111b2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**

 * Plugin sandbox — configurable isolation levels.

 *

 * @module plugins/sandbox

 */

export enum SandboxLevel {
  /** Run in-process (no isolation, fastest) */
  IN_PROCESS = 0,
  /** Run in child process with full environment */
  CHILD_FULL_ENV = 1,
  /** Run in child process with filtered environment */
  CHILD_FILTERED_ENV = 2,
  /** Run in child process with isolated environment (no env vars) */
  CHILD_ISOLATED = 3,
}

export function getSandboxLabel(level: SandboxLevel): string {
  switch (level) {
    case SandboxLevel.IN_PROCESS:
      return "In-Process";
    case SandboxLevel.CHILD_FULL_ENV:
      return "Child (Full Env)";
    case SandboxLevel.CHILD_FILTERED_ENV:
      return "Child (Filtered Env)";
    case SandboxLevel.CHILD_ISOLATED:
      return "Child (Isolated)";
  }
}