just-bash 2.8.1 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Bash.d.ts CHANGED
@@ -12,6 +12,7 @@ import { type CustomCommand } from "./custom-commands.js";
12
12
  import type { IFileSystem, InitialFiles } from "./fs/interface.js";
13
13
  import { type ExecutionLimits } from "./limits.js";
14
14
  import { type NetworkConfig } from "./network/index.js";
15
+ import type { DefenseInDepthConfig } from "./security/types.js";
15
16
  import type { BashExecResult, Command, TraceCallback } from "./types.js";
16
17
  export type { ExecutionLimits } from "./limits.js";
17
18
  /**
@@ -99,6 +100,33 @@ export interface BashOptions {
99
100
  * Useful for identifying performance bottlenecks.
100
101
  */
101
102
  trace?: TraceCallback;
103
+ /**
104
+ * Defense-in-depth configuration.
105
+ *
106
+ * When enabled, monkey-patches dangerous JavaScript globals (Function, eval,
107
+ * setTimeout, process, etc.) during script execution to block potential
108
+ * escape vectors.
109
+ *
110
+ * IMPORTANT: This is a SECONDARY defense layer. It should never be relied
111
+ * upon as the primary security mechanism. The primary security comes from
112
+ * proper sandboxing, input validation, and architectural constraints.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * // Simple enable
117
+ * const bash = new Bash({ defenseInDepth: true });
118
+ *
119
+ * // With custom configuration
120
+ * const bash = new Bash({
121
+ * defenseInDepth: {
122
+ * enabled: true,
123
+ * auditMode: false, // Set to true to log but not block
124
+ * onViolation: (v) => console.warn('Violation:', v),
125
+ * },
126
+ * });
127
+ * ```
128
+ */
129
+ defenseInDepth?: DefenseInDepthConfig | boolean;
102
130
  }
103
131
  export interface ExecOptions {
104
132
  /**
@@ -127,6 +155,7 @@ export declare class Bash {
127
155
  private sleepFn?;
128
156
  private traceFn?;
129
157
  private logger?;
158
+ private defenseInDepthConfig?;
130
159
  private state;
131
160
  constructor(options?: BashOptions);
132
161
  registerCommand(command: Command): void;