@themoltnet/pi-runtime 0.15.2 → 0.16.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/index.d.ts +17 -6
- package/dist/index.js +2265 -2217
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -455,14 +455,19 @@ export declare function decideForEvent(event: ToolCallEvent, policy: SessionTool
|
|
|
455
455
|
* allow-set can't bound it. This is the interim conservative stance for
|
|
456
456
|
* issue #1348 — an operator who lists `bash` still cannot smuggle
|
|
457
457
|
* `bash -c "curl … | sh"` past `enforce`.
|
|
458
|
-
* 3. **
|
|
458
|
+
* 3. **Unauthorized executables** — any resolved executable without a matching
|
|
459
|
+
* shell-command rule. Tool names in `allowedTools` never authorize a shell
|
|
460
|
+
* invocation.
|
|
461
|
+
* 4. **Output redirection** — a `bash` command that redirects output (`>`,
|
|
462
|
+
* `2>`, `>>`, `&>`, …). No shell-command rule authorizes it; file writes go
|
|
463
|
+
* through structured tools.
|
|
459
464
|
*
|
|
460
465
|
* KNOWN LIMITATION (follow-up): the `escapable` risk tier (GTFOBins binaries
|
|
461
466
|
* like `find`, `tar`, `awk` that document shell-spawn / file-write techniques)
|
|
462
467
|
* is NOT blocked on the tier alone. The analyzer already re-analyzes the
|
|
463
468
|
* sub-commands it can see through documented escape flags (`find -exec`,
|
|
464
469
|
* `tar --to-command`, …), but techniques it cannot parse statically could still
|
|
465
|
-
* escape
|
|
470
|
+
* escape an argv-prefix rule. Tightening `escapable` (e.g. an LLM judge or a
|
|
466
471
|
* capability-aware allow-set) is tracked as future work.
|
|
467
472
|
*/
|
|
468
473
|
export declare function decideToolCall(input: GateInput): GateDecision;
|
|
@@ -767,9 +772,15 @@ export declare interface GateInput {
|
|
|
767
772
|
/** The shell command, when `toolName === 'bash'`. */
|
|
768
773
|
command?: string;
|
|
769
774
|
enforcement: ToolEnforcement;
|
|
770
|
-
/**
|
|
775
|
+
/**
|
|
776
|
+
* Runtime and MCP tool names the policy allows. Matched against `toolName`
|
|
777
|
+
* only; a tool name never authorizes a shell invocation.
|
|
778
|
+
*/
|
|
771
779
|
allowedTools: ReadonlySet<string>;
|
|
772
|
-
/**
|
|
780
|
+
/**
|
|
781
|
+
* Shell argv rules, the only authority for shell invocations. Each rule
|
|
782
|
+
* matches the first N statically known tokens.
|
|
783
|
+
*/
|
|
773
784
|
allowedShellCommands: readonly ShellCommandRule[];
|
|
774
785
|
/**
|
|
775
786
|
* Synchronous shell analyzer (`ShellCommandAnalyzer.analyze`). Injected so the
|
|
@@ -1447,7 +1458,7 @@ export declare interface SessionToolPolicy {
|
|
|
1447
1458
|
}
|
|
1448
1459
|
|
|
1449
1460
|
declare interface ShellCommandRule {
|
|
1450
|
-
argvPrefix: readonly [string,
|
|
1461
|
+
argvPrefix: readonly [string, ...string[]];
|
|
1451
1462
|
}
|
|
1452
1463
|
|
|
1453
1464
|
export { SnapshotConfig }
|
|
@@ -1518,7 +1529,7 @@ export declare interface ToolPolicyDecisionContext {
|
|
|
1518
1529
|
* - `{ allow: false, reason }` — block it (enforce mode).
|
|
1519
1530
|
* - `{ audit, ... }` — would-block, but proceed and record it (watch mode).
|
|
1520
1531
|
*/
|
|
1521
|
-
export declare type ToolPolicyDecisionReason = 'policy_off' | 'executor_protocol_tool' | 'policy_allowed' | 'shell_command_prefix_allowed' | 'shell_command_unresolvable' | 'arbitrary_code_interpreter' | '
|
|
1532
|
+
export declare type ToolPolicyDecisionReason = 'policy_off' | 'executor_protocol_tool' | 'policy_allowed' | 'shell_command_prefix_allowed' | 'shell_command_unresolvable' | 'arbitrary_code_interpreter' | 'shell_output_redirection_not_permitted' | 'tool_not_permitted';
|
|
1522
1533
|
|
|
1523
1534
|
export declare interface ToolPolicyExtensionDeps {
|
|
1524
1535
|
policy: SessionToolPolicy;
|