opencode-swarm 6.69.0 → 6.71.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/cli/index.js +427 -90
- package/dist/config/schema.d.ts +6 -0
- package/dist/hooks/delegation-gate.d.ts +11 -0
- package/dist/hooks/guardrails.d.ts +43 -1
- package/dist/index.js +41560 -41101
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* - Layer 1 (Soft Warning @ warning_threshold): Sets warning flag for messagesTransform to inject warning
|
|
7
7
|
* - Layer 2 (Hard Block @ 100%): Throws error in toolBefore to block further calls, injects STOP message
|
|
8
8
|
*/
|
|
9
|
+
import * as path from 'node:path';
|
|
9
10
|
import { type AuthorityConfig, type GuardrailsConfig } from '../config/schema';
|
|
10
11
|
import { type FileZone } from '../context/zone-classifier';
|
|
11
12
|
/**
|
|
@@ -27,6 +28,13 @@ export declare function setStoredInputArgs(callID: string, args: unknown): void;
|
|
|
27
28
|
* @param callID The callID to delete
|
|
28
29
|
*/
|
|
29
30
|
export declare function deleteStoredInputArgs(callID: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Redacts sensitive values from a shell command string before audit logging.
|
|
33
|
+
* Covers env-var assignments, CLI flags, Bearer/Basic auth, and -H header flags.
|
|
34
|
+
* Conservative: only redacts patterns with well-known secret-bearing names.
|
|
35
|
+
* Export allows unit testing without spinning up a full hooks factory.
|
|
36
|
+
*/
|
|
37
|
+
export declare function redactShellCommand(cmd: string): string;
|
|
30
38
|
/**
|
|
31
39
|
* Creates guardrails hooks for circuit breaker protection
|
|
32
40
|
* @param directory Working directory from plugin init context (required)
|
|
@@ -119,10 +127,44 @@ type AgentRule = {
|
|
|
119
127
|
allowedGlobs?: string[];
|
|
120
128
|
};
|
|
121
129
|
export declare const DEFAULT_AGENT_AUTHORITY_RULES: Record<string, AgentRule>;
|
|
130
|
+
/**
|
|
131
|
+
* Checks whether a write target path (or any ancestor strictly inside cwd)
|
|
132
|
+
* is a symlink. Writing through a symlink can redirect the write to a
|
|
133
|
+
* location outside the working directory, bypassing scope containment.
|
|
134
|
+
*
|
|
135
|
+
* The walk stops at cwd — cwd itself is NOT lstat'd. A user's chosen
|
|
136
|
+
* working directory may legitimately be reached via a symlink (e.g.,
|
|
137
|
+
* macOS's /tmp → /private/tmp), and that symlink does not constitute a
|
|
138
|
+
* redirect *within* the workspace. Only attacker-plantable symlinks
|
|
139
|
+
* BELOW cwd are relevant to this guard.
|
|
140
|
+
*
|
|
141
|
+
* ENOENT on any node in the chain is allowed — the file/dir doesn't exist yet.
|
|
142
|
+
* Any other lstat error (EPERM, EACCES, ENAMETOOLONG, …) fails closed:
|
|
143
|
+
* an unverifiable ancestor must not be written through, even if the OS
|
|
144
|
+
* would eventually reject the write. Defense-in-depth over optimism.
|
|
145
|
+
*
|
|
146
|
+
* @returns A block reason string if a symlink is detected, null if all clear.
|
|
147
|
+
*/
|
|
148
|
+
export declare function checkWriteTargetForSymlink(targetPath: string, cwd: string): string | null;
|
|
149
|
+
/**
|
|
150
|
+
* Returns true when `targetAbsolute` and `cwdAbsolute` resolve to different
|
|
151
|
+
* filesystem roots. On POSIX this is always false (single root `/`); on
|
|
152
|
+
* Windows it is true when the two paths sit on different drive letters or
|
|
153
|
+
* different UNC roots — the symptom Codex flagged on PR #501, where
|
|
154
|
+
* `path.relative('C:\\repo', 'D:\\secret.txt')` returns the absolute
|
|
155
|
+
* `'D:\\secret.txt'` and slips past `startsWith('../')` containment.
|
|
156
|
+
*
|
|
157
|
+
* Exposed (and accepts an injectable `pathLib`) so the cross-drive guard
|
|
158
|
+
* is falsifiable on Linux CI without depending on a Windows runner: tests
|
|
159
|
+
* pass `path.win32` / `path.posix` directly.
|
|
160
|
+
*/
|
|
161
|
+
export declare function isOnDifferentFilesystemRoot(targetAbsolute: string, cwdAbsolute: string, pathLib?: Pick<typeof path, 'parse'>): boolean;
|
|
122
162
|
/**
|
|
123
163
|
* Checks whether the given agent is authorised to write to the given file path.
|
|
124
164
|
*/
|
|
125
|
-
export declare function checkFileAuthority(agentName: string, filePath: string, cwd: string, authorityConfig?: AuthorityConfig
|
|
165
|
+
export declare function checkFileAuthority(agentName: string, filePath: string, cwd: string, authorityConfig?: AuthorityConfig, options?: {
|
|
166
|
+
declaredScope?: string[] | null;
|
|
167
|
+
}): {
|
|
126
168
|
allowed: true;
|
|
127
169
|
} | {
|
|
128
170
|
allowed: false;
|