@agenshield/broker 0.6.1 → 0.7.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/daemon-forward.d.ts +4 -1
- package/daemon-forward.d.ts.map +1 -1
- package/handlers/exec.d.ts.map +1 -1
- package/handlers/policy-check.d.ts +3 -0
- package/handlers/policy-check.d.ts.map +1 -1
- package/handlers/skill-install.d.ts.map +1 -1
- package/handlers/types.d.ts +3 -0
- package/handlers/types.d.ts.map +1 -1
- package/http-fallback.d.ts.map +1 -1
- package/index.js +89 -66
- package/main.js +350 -79
- package/package.json +3 -2
- package/policies/command-allowlist.d.ts.map +1 -1
- package/policies/enforcer.d.ts +6 -0
- package/policies/enforcer.d.ts.map +1 -1
- package/secrets/resolver.d.ts +38 -0
- package/secrets/resolver.d.ts.map +1 -0
- package/server.d.ts +3 -0
- package/server.d.ts.map +1 -1
- package/types.d.ts +2 -0
- package/types.d.ts.map +1 -1
package/daemon-forward.d.ts
CHANGED
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* in server.ts / http-fallback.ts when the broker's local enforcer denies
|
|
7
7
|
* a request but the daemon may have a user-defined policy that allows it.
|
|
8
8
|
*/
|
|
9
|
+
import type { SandboxConfig, PolicyExecutionContext } from '@agenshield/ipc';
|
|
9
10
|
export interface DaemonPolicyResult {
|
|
10
11
|
allowed: boolean;
|
|
11
12
|
policyId?: string;
|
|
12
13
|
reason?: string;
|
|
14
|
+
sandbox?: SandboxConfig;
|
|
15
|
+
executionContext?: PolicyExecutionContext;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* Forward a policy check to the daemon's RPC endpoint.
|
|
@@ -21,5 +24,5 @@ export interface DaemonPolicyResult {
|
|
|
21
24
|
*
|
|
22
25
|
* @returns The daemon's result if it explicitly allows, or null to keep broker denial.
|
|
23
26
|
*/
|
|
24
|
-
export declare function forwardPolicyToDaemon(operation: string, target: string, daemonUrl: string): Promise<DaemonPolicyResult | null>;
|
|
27
|
+
export declare function forwardPolicyToDaemon(operation: string, target: string, daemonUrl: string, context?: PolicyExecutionContext): Promise<DaemonPolicyResult | null>;
|
|
25
28
|
//# sourceMappingURL=daemon-forward.d.ts.map
|
package/daemon-forward.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon-forward.d.ts","sourceRoot":"","sources":["../src/daemon-forward.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"daemon-forward.d.ts","sourceRoot":"","sources":["../src/daemon-forward.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAK7E,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;CAC3C;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAuEpC"}
|
package/handlers/exec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/handlers/exec.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgGtD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/handlers/exec.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgGtD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CA4HpC"}
|
|
@@ -10,10 +10,13 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { HandlerContext, HandlerResult } from '../types.js';
|
|
12
12
|
import type { HandlerDependencies } from './types.js';
|
|
13
|
+
import type { SandboxConfig, PolicyExecutionContext } from '@agenshield/ipc';
|
|
13
14
|
interface PolicyCheckResultData {
|
|
14
15
|
allowed: boolean;
|
|
15
16
|
policyId?: string;
|
|
16
17
|
reason?: string;
|
|
18
|
+
sandbox?: SandboxConfig;
|
|
19
|
+
executionContext?: PolicyExecutionContext;
|
|
17
20
|
}
|
|
18
21
|
export declare function handlePolicyCheck(params: Record<string, unknown>, context: HandlerContext, deps: HandlerDependencies): Promise<HandlerResult<PolicyCheckResultData>>;
|
|
19
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-check.d.ts","sourceRoot":"","sources":["../../src/handlers/policy-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"policy-check.d.ts","sourceRoot":"","sources":["../../src/handlers/policy-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAS7E,UAAU,qBAAqB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;CAC3C;AAKD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,CA6E/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-install.d.ts","sourceRoot":"","sources":["../../src/handlers/skill-install.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"skill-install.d.ts","sourceRoot":"","sources":["../../src/handlers/skill-install.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEb,kBAAkB,EAElB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA4CtD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,CA0H5C;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC,CAqE9C"}
|
package/handlers/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { PolicyEnforcer } from '../policies/enforcer.js';
|
|
5
5
|
import type { AuditLogger } from '../audit/logger.js';
|
|
6
6
|
import type { SecretVault } from '../secrets/vault.js';
|
|
7
|
+
import type { SecretResolver } from '../secrets/resolver.js';
|
|
7
8
|
import type { CommandAllowlist } from '../policies/command-allowlist.js';
|
|
8
9
|
/**
|
|
9
10
|
* Exec monitoring event emitted after each exec operation
|
|
@@ -16,11 +17,13 @@ export interface ExecMonitorEvent {
|
|
|
16
17
|
allowed: boolean;
|
|
17
18
|
duration: number;
|
|
18
19
|
timestamp: string;
|
|
20
|
+
injectedSecretNames?: string[];
|
|
19
21
|
}
|
|
20
22
|
export interface HandlerDependencies {
|
|
21
23
|
policyEnforcer: PolicyEnforcer;
|
|
22
24
|
auditLogger: AuditLogger;
|
|
23
25
|
secretVault: SecretVault;
|
|
26
|
+
secretResolver?: SecretResolver;
|
|
24
27
|
commandAllowlist: CommandAllowlist;
|
|
25
28
|
onExecMonitor?: (event: ExecMonitorEvent) => void;
|
|
26
29
|
onExecDenied?: (command: string, reason: string) => void;
|
package/handlers/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/handlers/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAA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AC;IAChC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/http-fallback.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-fallback.d.ts","sourceRoot":"","sources":["../src/http-fallback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAsBxE,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,WAAW,CAAC;IACzB,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,EAAE,yBAAyB;IAO9C;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAY3B;;OAEG;YACW,aAAa;IA6C3B;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;YACW,cAAc;
|
|
1
|
+
{"version":3,"file":"http-fallback.d.ts","sourceRoot":"","sources":["../src/http-fallback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAsBxE,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,WAAW,CAAC;IACzB,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,EAAE,yBAAyB;IAO9C;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAY3B;;OAEG;YACW,aAAa;IA6C3B;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;YACW,cAAc;IAqI5B;;OAEG;IACH,OAAO,CAAC,UAAU;IAsBlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAWrB;;OAEG;IACH,OAAO,CAAC,aAAa;CAWtB"}
|
package/index.js
CHANGED
|
@@ -252,8 +252,10 @@ import { spawn } from "node:child_process";
|
|
|
252
252
|
|
|
253
253
|
// libs/shield-broker/src/daemon-forward.ts
|
|
254
254
|
var DAEMON_RPC_TIMEOUT = 2e3;
|
|
255
|
-
async function forwardPolicyToDaemon(operation, target, daemonUrl) {
|
|
255
|
+
async function forwardPolicyToDaemon(operation, target, daemonUrl, context) {
|
|
256
|
+
const verbose = process.env["AGENSHIELD_BROKER_VERBOSE"] === "true";
|
|
256
257
|
try {
|
|
258
|
+
if (verbose) console.error(`[broker:forward] op=${operation} target=${target} \u2192 daemon ${daemonUrl}`);
|
|
257
259
|
const controller = new AbortController();
|
|
258
260
|
const timeout = setTimeout(() => controller.abort(), DAEMON_RPC_TIMEOUT);
|
|
259
261
|
const response = await fetch(`${daemonUrl}/rpc`, {
|
|
@@ -263,7 +265,7 @@ async function forwardPolicyToDaemon(operation, target, daemonUrl) {
|
|
|
263
265
|
jsonrpc: "2.0",
|
|
264
266
|
id: `broker-fwd-${Date.now()}`,
|
|
265
267
|
method: "policy_check",
|
|
266
|
-
params: { operation, target }
|
|
268
|
+
params: { operation, target, context }
|
|
267
269
|
}),
|
|
268
270
|
signal: controller.signal
|
|
269
271
|
});
|
|
@@ -276,11 +278,22 @@ async function forwardPolicyToDaemon(operation, target, daemonUrl) {
|
|
|
276
278
|
return null;
|
|
277
279
|
}
|
|
278
280
|
const result = json.result;
|
|
281
|
+
if (verbose) console.error(`[broker:forward] result: allowed=${result.allowed} policyId=${result.policyId}`);
|
|
279
282
|
if (result.policyId) {
|
|
280
283
|
return {
|
|
281
284
|
allowed: !!result.allowed,
|
|
282
285
|
policyId: result.policyId,
|
|
283
|
-
reason: result.reason
|
|
286
|
+
reason: result.reason,
|
|
287
|
+
sandbox: result.sandbox,
|
|
288
|
+
executionContext: result.executionContext
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
if (result.sandbox) {
|
|
292
|
+
return {
|
|
293
|
+
allowed: true,
|
|
294
|
+
reason: result.reason,
|
|
295
|
+
sandbox: result.sandbox,
|
|
296
|
+
executionContext: result.executionContext
|
|
284
297
|
};
|
|
285
298
|
}
|
|
286
299
|
return null;
|
|
@@ -436,11 +449,17 @@ async function handleExec(params, context, deps) {
|
|
|
436
449
|
}
|
|
437
450
|
}
|
|
438
451
|
const effectiveTimeout = HTTP_EXEC_COMMANDS.has(commandBasename) ? Math.max(timeout, 3e5) : timeout;
|
|
452
|
+
const secretEnv = deps.secretResolver?.getSecretsForExec(
|
|
453
|
+
commandBasename,
|
|
454
|
+
args
|
|
455
|
+
) ?? {};
|
|
456
|
+
const injectedSecretNames = Object.keys(secretEnv);
|
|
457
|
+
const mergedEnv = injectedSecretNames.length > 0 ? { ...env || {}, ...secretEnv } : env;
|
|
439
458
|
const result = await executeCommand({
|
|
440
459
|
command: resolvedCommand,
|
|
441
460
|
args,
|
|
442
461
|
cwd: effectiveCwd,
|
|
443
|
-
env,
|
|
462
|
+
env: mergedEnv,
|
|
444
463
|
timeout: effectiveTimeout,
|
|
445
464
|
shell: false
|
|
446
465
|
// Always force shell: false to prevent injection
|
|
@@ -453,7 +472,8 @@ async function handleExec(params, context, deps) {
|
|
|
453
472
|
exitCode: result.exitCode,
|
|
454
473
|
allowed: true,
|
|
455
474
|
duration,
|
|
456
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
475
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
476
|
+
injectedSecretNames: injectedSecretNames.length > 0 ? injectedSecretNames : void 0
|
|
457
477
|
});
|
|
458
478
|
return {
|
|
459
479
|
success: true,
|
|
@@ -640,7 +660,6 @@ async function handlePing(params, context, deps) {
|
|
|
640
660
|
|
|
641
661
|
// libs/shield-broker/src/handlers/skill-install.ts
|
|
642
662
|
import * as fs2 from "node:fs/promises";
|
|
643
|
-
import * as fsSync from "node:fs";
|
|
644
663
|
import * as path3 from "node:path";
|
|
645
664
|
import { execSync } from "node:child_process";
|
|
646
665
|
function isValidSlug(slug) {
|
|
@@ -677,13 +696,14 @@ fi
|
|
|
677
696
|
}
|
|
678
697
|
async function handleSkillInstall(params, context, deps) {
|
|
679
698
|
const startTime = Date.now();
|
|
699
|
+
const warnings = [];
|
|
680
700
|
try {
|
|
681
701
|
const {
|
|
682
702
|
slug,
|
|
683
703
|
files,
|
|
684
704
|
createWrapper = true,
|
|
685
705
|
agentHome = process.env["AGENSHIELD_AGENT_HOME"] || "/Users/ash_default_agent",
|
|
686
|
-
socketGroup = process.env["AGENSHIELD_SOCKET_GROUP"] || "
|
|
706
|
+
socketGroup = process.env["AGENSHIELD_SOCKET_GROUP"] || "ash_default"
|
|
687
707
|
} = params;
|
|
688
708
|
if (!slug || !isValidSlug(slug)) {
|
|
689
709
|
return {
|
|
@@ -725,30 +745,11 @@ async function handleSkillInstall(params, context, deps) {
|
|
|
725
745
|
filesWritten++;
|
|
726
746
|
}
|
|
727
747
|
try {
|
|
728
|
-
execSync(`chown -R root:${socketGroup} "${skillDir}"`, { stdio: "pipe" });
|
|
729
748
|
execSync(`chmod -R a+rX,go-w "${skillDir}"`, { stdio: "pipe" });
|
|
730
749
|
} catch (err) {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
try {
|
|
735
|
-
let openclawConfig = {};
|
|
736
|
-
try {
|
|
737
|
-
const raw = fsSync.readFileSync(openclawConfigPath, "utf-8");
|
|
738
|
-
openclawConfig = JSON.parse(raw);
|
|
739
|
-
} catch {
|
|
740
|
-
}
|
|
741
|
-
if (!openclawConfig.skills) {
|
|
742
|
-
openclawConfig.skills = {};
|
|
743
|
-
}
|
|
744
|
-
const skills = openclawConfig.skills;
|
|
745
|
-
if (!skills.entries) {
|
|
746
|
-
skills.entries = {};
|
|
747
|
-
}
|
|
748
|
-
skills.entries[slug] = { enabled: true };
|
|
749
|
-
fsSync.writeFileSync(openclawConfigPath, JSON.stringify(openclawConfig, null, 2), "utf-8");
|
|
750
|
-
} catch (err) {
|
|
751
|
-
console.warn(`[SkillInstall] openclaw.json update failed: ${err.message}`);
|
|
750
|
+
const msg = `chmod on skill dir failed: ${err.message}`;
|
|
751
|
+
console.warn(`[SkillInstall] ${msg}`);
|
|
752
|
+
warnings.push(msg);
|
|
752
753
|
}
|
|
753
754
|
let wrapperPath;
|
|
754
755
|
if (createWrapper) {
|
|
@@ -756,12 +757,6 @@ async function handleSkillInstall(params, context, deps) {
|
|
|
756
757
|
await fs2.mkdir(binDir, { recursive: true });
|
|
757
758
|
const wrapperContent = createWrapperContent(slug, skillDir);
|
|
758
759
|
await fs2.writeFile(wrapperPath, wrapperContent, { mode: 493 });
|
|
759
|
-
try {
|
|
760
|
-
execSync(`chown root:${socketGroup} "${wrapperPath}"`, { stdio: "pipe" });
|
|
761
|
-
execSync(`chmod 755 "${wrapperPath}"`, { stdio: "pipe" });
|
|
762
|
-
} catch (err) {
|
|
763
|
-
console.warn(`[SkillInstall] wrapper chown failed: ${err.message}`);
|
|
764
|
-
}
|
|
765
760
|
}
|
|
766
761
|
return {
|
|
767
762
|
success: true,
|
|
@@ -769,7 +764,8 @@ async function handleSkillInstall(params, context, deps) {
|
|
|
769
764
|
installed: true,
|
|
770
765
|
skillDir,
|
|
771
766
|
wrapperPath,
|
|
772
|
-
filesWritten
|
|
767
|
+
filesWritten,
|
|
768
|
+
warnings: warnings.length > 0 ? warnings : void 0
|
|
773
769
|
},
|
|
774
770
|
audit: {
|
|
775
771
|
duration: Date.now() - startTime,
|
|
@@ -810,18 +806,6 @@ async function handleSkillUninstall(params, context, deps) {
|
|
|
810
806
|
if (skillExists) {
|
|
811
807
|
await fs2.rm(skillDir, { recursive: true, force: true });
|
|
812
808
|
}
|
|
813
|
-
const openclawConfigPath = path3.join(agentHome, ".openclaw", "openclaw.json");
|
|
814
|
-
try {
|
|
815
|
-
const raw = fsSync.readFileSync(openclawConfigPath, "utf-8");
|
|
816
|
-
const openclawConfig = JSON.parse(raw);
|
|
817
|
-
const skills = openclawConfig.skills;
|
|
818
|
-
const entries = skills?.entries;
|
|
819
|
-
if (entries?.[slug]) {
|
|
820
|
-
delete entries[slug];
|
|
821
|
-
fsSync.writeFileSync(openclawConfigPath, JSON.stringify(openclawConfig, null, 2), "utf-8");
|
|
822
|
-
}
|
|
823
|
-
} catch {
|
|
824
|
-
}
|
|
825
809
|
let wrapperRemoved = false;
|
|
826
810
|
if (removeWrapper) {
|
|
827
811
|
try {
|
|
@@ -853,7 +837,7 @@ async function handleSkillUninstall(params, context, deps) {
|
|
|
853
837
|
// libs/shield-broker/src/handlers/policy-check.ts
|
|
854
838
|
var DEFAULT_DAEMON_URL = "http://127.0.0.1:5200";
|
|
855
839
|
async function handlePolicyCheck(params, context, deps) {
|
|
856
|
-
const { operation, target } = params;
|
|
840
|
+
const { operation, target, context: execContext } = params;
|
|
857
841
|
if (!operation) {
|
|
858
842
|
return {
|
|
859
843
|
success: false,
|
|
@@ -893,9 +877,18 @@ async function handlePolicyCheck(params, context, deps) {
|
|
|
893
877
|
};
|
|
894
878
|
}
|
|
895
879
|
const daemonUrl = deps.daemonUrl || DEFAULT_DAEMON_URL;
|
|
896
|
-
const daemonResult = await forwardPolicyToDaemon(operation, target || "", daemonUrl);
|
|
880
|
+
const daemonResult = await forwardPolicyToDaemon(operation, target || "", daemonUrl, execContext);
|
|
897
881
|
if (daemonResult && daemonResult.allowed) {
|
|
898
|
-
return {
|
|
882
|
+
return {
|
|
883
|
+
success: true,
|
|
884
|
+
data: {
|
|
885
|
+
allowed: daemonResult.allowed,
|
|
886
|
+
policyId: daemonResult.policyId,
|
|
887
|
+
reason: daemonResult.reason,
|
|
888
|
+
sandbox: daemonResult.sandbox,
|
|
889
|
+
executionContext: daemonResult.executionContext
|
|
890
|
+
}
|
|
891
|
+
};
|
|
899
892
|
}
|
|
900
893
|
return {
|
|
901
894
|
success: true,
|
|
@@ -937,6 +930,7 @@ var UnixSocketServer = class {
|
|
|
937
930
|
policyEnforcer;
|
|
938
931
|
auditLogger;
|
|
939
932
|
secretVault;
|
|
933
|
+
secretResolver;
|
|
940
934
|
commandAllowlist;
|
|
941
935
|
connections = /* @__PURE__ */ new Set();
|
|
942
936
|
constructor(options) {
|
|
@@ -944,6 +938,7 @@ var UnixSocketServer = class {
|
|
|
944
938
|
this.policyEnforcer = options.policyEnforcer;
|
|
945
939
|
this.auditLogger = options.auditLogger;
|
|
946
940
|
this.secretVault = options.secretVault;
|
|
941
|
+
this.secretResolver = options.secretResolver;
|
|
947
942
|
this.commandAllowlist = options.commandAllowlist;
|
|
948
943
|
}
|
|
949
944
|
/**
|
|
@@ -1043,13 +1038,9 @@ var UnixSocketServer = class {
|
|
|
1043
1038
|
config: this.config
|
|
1044
1039
|
// Socket credentials would be extracted here on supported platforms
|
|
1045
1040
|
};
|
|
1046
|
-
const policyResult = await this.policyEnforcer.check(
|
|
1047
|
-
request.method,
|
|
1048
|
-
request.params,
|
|
1049
|
-
context
|
|
1050
|
-
);
|
|
1041
|
+
const policyResult = request.method === "policy_check" ? { allowed: true, policyId: void 0, reason: void 0 } : await this.policyEnforcer.check(request.method, request.params, context);
|
|
1051
1042
|
let finalPolicy = policyResult;
|
|
1052
|
-
if (!policyResult.allowed
|
|
1043
|
+
if (!policyResult.allowed) {
|
|
1053
1044
|
const target = this.extractTarget(request);
|
|
1054
1045
|
const daemonUrl = this.config.daemonUrl || "http://127.0.0.1:5200";
|
|
1055
1046
|
const override = await forwardPolicyToDaemon(request.method, target, daemonUrl);
|
|
@@ -1080,6 +1071,7 @@ var UnixSocketServer = class {
|
|
|
1080
1071
|
policyEnforcer: this.policyEnforcer,
|
|
1081
1072
|
auditLogger: this.auditLogger,
|
|
1082
1073
|
secretVault: this.secretVault,
|
|
1074
|
+
secretResolver: this.secretResolver,
|
|
1083
1075
|
commandAllowlist: this.commandAllowlist,
|
|
1084
1076
|
daemonUrl: this.config.daemonUrl
|
|
1085
1077
|
});
|
|
@@ -1296,13 +1288,9 @@ var HttpFallbackServer = class {
|
|
|
1296
1288
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1297
1289
|
config: this.config
|
|
1298
1290
|
};
|
|
1299
|
-
const policyResult = await this.policyEnforcer.check(
|
|
1300
|
-
request.method,
|
|
1301
|
-
request.params,
|
|
1302
|
-
context
|
|
1303
|
-
);
|
|
1291
|
+
const policyResult = request.method === "policy_check" ? { allowed: true, policyId: void 0, reason: void 0 } : await this.policyEnforcer.check(request.method, request.params, context);
|
|
1304
1292
|
let finalPolicy = policyResult;
|
|
1305
|
-
if (!policyResult.allowed
|
|
1293
|
+
if (!policyResult.allowed) {
|
|
1306
1294
|
const target = this.extractTarget(request);
|
|
1307
1295
|
const daemonUrl = this.config.daemonUrl || "http://127.0.0.1:5200";
|
|
1308
1296
|
const override = await forwardPolicyToDaemon(request.method, target, daemonUrl);
|
|
@@ -1412,6 +1400,7 @@ var PolicyEnforcer = class {
|
|
|
1412
1400
|
lastLoad = 0;
|
|
1413
1401
|
reloadInterval = 6e4;
|
|
1414
1402
|
// 1 minute
|
|
1403
|
+
verbose = process.env["AGENSHIELD_BROKER_VERBOSE"] === "true";
|
|
1415
1404
|
constructor(options) {
|
|
1416
1405
|
this.policiesPath = options.policiesPath;
|
|
1417
1406
|
this.failOpen = options.failOpen;
|
|
@@ -1499,13 +1488,17 @@ var PolicyEnforcer = class {
|
|
|
1499
1488
|
this.maybeReload();
|
|
1500
1489
|
try {
|
|
1501
1490
|
const target = this.extractTarget(operation, params);
|
|
1491
|
+
if (this.verbose) console.error(`[broker:enforcer] op=${operation} target=${target}`);
|
|
1502
1492
|
for (const rule of this.policies.rules) {
|
|
1503
1493
|
if (!rule.enabled) continue;
|
|
1504
1494
|
if (!rule.operations.includes(operation) && !rule.operations.includes("*")) {
|
|
1505
1495
|
continue;
|
|
1506
1496
|
}
|
|
1507
|
-
const matches = this.matchesPatterns(target, rule.patterns);
|
|
1497
|
+
const matches = this.matchesPatterns(target, rule.patterns, operation);
|
|
1508
1498
|
if (matches) {
|
|
1499
|
+
if (this.verbose) {
|
|
1500
|
+
console.error(`[broker:enforcer] MATCH rule=${rule.id} action=${rule.action} patterns=${rule.patterns.join(",")}`);
|
|
1501
|
+
}
|
|
1509
1502
|
if (rule.action === "deny" || rule.action === "approval") {
|
|
1510
1503
|
return {
|
|
1511
1504
|
allowed: false,
|
|
@@ -1530,6 +1523,9 @@ var PolicyEnforcer = class {
|
|
|
1530
1523
|
if (operation === "http_request" && this.policies.networkConstraints) {
|
|
1531
1524
|
return { allowed: true, reason: "Allowed by network constraints" };
|
|
1532
1525
|
}
|
|
1526
|
+
if (this.verbose) {
|
|
1527
|
+
console.error(`[broker:enforcer] DEFAULT action=${this.policies.defaultAction} (no rule matched)`);
|
|
1528
|
+
}
|
|
1533
1529
|
return {
|
|
1534
1530
|
allowed: this.policies.defaultAction === "allow",
|
|
1535
1531
|
reason: this.policies.defaultAction === "deny" ? "No matching allow policy" : void 0
|
|
@@ -1563,12 +1559,39 @@ var PolicyEnforcer = class {
|
|
|
1563
1559
|
return "";
|
|
1564
1560
|
}
|
|
1565
1561
|
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Match a command target against a Claude Code-style command pattern.
|
|
1564
|
+
* See matchCommandPattern in daemon rpc.ts for full semantics.
|
|
1565
|
+
*/
|
|
1566
|
+
matchCommandPattern(pattern, target) {
|
|
1567
|
+
const trimmed = pattern.trim();
|
|
1568
|
+
if (trimmed === "*") return true;
|
|
1569
|
+
if (trimmed.endsWith(":*")) {
|
|
1570
|
+
const prefix = trimmed.slice(0, -2).toLowerCase();
|
|
1571
|
+
const lowerTarget = target.toLowerCase();
|
|
1572
|
+
if (lowerTarget === prefix || lowerTarget.startsWith(prefix + " ")) {
|
|
1573
|
+
return true;
|
|
1574
|
+
}
|
|
1575
|
+
const firstSpace = lowerTarget.indexOf(" ");
|
|
1576
|
+
const cmdPart = firstSpace >= 0 ? lowerTarget.slice(0, firstSpace) : lowerTarget;
|
|
1577
|
+
const lastSlash = cmdPart.lastIndexOf("/");
|
|
1578
|
+
if (lastSlash >= 0) {
|
|
1579
|
+
const basename2 = cmdPart.slice(lastSlash + 1);
|
|
1580
|
+
if (basename2 === prefix || basename2.startsWith(prefix + "-") || basename2.startsWith(prefix)) {
|
|
1581
|
+
return true;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
return false;
|
|
1585
|
+
}
|
|
1586
|
+
return target.toLowerCase() === trimmed.toLowerCase();
|
|
1587
|
+
}
|
|
1566
1588
|
/**
|
|
1567
1589
|
* Check if target matches any patterns
|
|
1568
1590
|
*/
|
|
1569
|
-
matchesPatterns(target, patterns) {
|
|
1591
|
+
matchesPatterns(target, patterns, operation) {
|
|
1570
1592
|
for (const pattern of patterns) {
|
|
1571
|
-
|
|
1593
|
+
const isExec = operation === "exec" || operation === "*";
|
|
1594
|
+
if (isExec ? this.matchCommandPattern(pattern, target) : this.matchPattern(target, pattern)) {
|
|
1572
1595
|
return true;
|
|
1573
1596
|
}
|
|
1574
1597
|
}
|
package/main.js
CHANGED
|
@@ -254,8 +254,10 @@ import { spawn } from "node:child_process";
|
|
|
254
254
|
|
|
255
255
|
// libs/shield-broker/src/daemon-forward.ts
|
|
256
256
|
var DAEMON_RPC_TIMEOUT = 2e3;
|
|
257
|
-
async function forwardPolicyToDaemon(operation, target, daemonUrl) {
|
|
257
|
+
async function forwardPolicyToDaemon(operation, target, daemonUrl, context) {
|
|
258
|
+
const verbose = process.env["AGENSHIELD_BROKER_VERBOSE"] === "true";
|
|
258
259
|
try {
|
|
260
|
+
if (verbose) console.error(`[broker:forward] op=${operation} target=${target} \u2192 daemon ${daemonUrl}`);
|
|
259
261
|
const controller = new AbortController();
|
|
260
262
|
const timeout = setTimeout(() => controller.abort(), DAEMON_RPC_TIMEOUT);
|
|
261
263
|
const response = await fetch(`${daemonUrl}/rpc`, {
|
|
@@ -265,7 +267,7 @@ async function forwardPolicyToDaemon(operation, target, daemonUrl) {
|
|
|
265
267
|
jsonrpc: "2.0",
|
|
266
268
|
id: `broker-fwd-${Date.now()}`,
|
|
267
269
|
method: "policy_check",
|
|
268
|
-
params: { operation, target }
|
|
270
|
+
params: { operation, target, context }
|
|
269
271
|
}),
|
|
270
272
|
signal: controller.signal
|
|
271
273
|
});
|
|
@@ -278,11 +280,22 @@ async function forwardPolicyToDaemon(operation, target, daemonUrl) {
|
|
|
278
280
|
return null;
|
|
279
281
|
}
|
|
280
282
|
const result = json.result;
|
|
283
|
+
if (verbose) console.error(`[broker:forward] result: allowed=${result.allowed} policyId=${result.policyId}`);
|
|
281
284
|
if (result.policyId) {
|
|
282
285
|
return {
|
|
283
286
|
allowed: !!result.allowed,
|
|
284
287
|
policyId: result.policyId,
|
|
285
|
-
reason: result.reason
|
|
288
|
+
reason: result.reason,
|
|
289
|
+
sandbox: result.sandbox,
|
|
290
|
+
executionContext: result.executionContext
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
if (result.sandbox) {
|
|
294
|
+
return {
|
|
295
|
+
allowed: true,
|
|
296
|
+
reason: result.reason,
|
|
297
|
+
sandbox: result.sandbox,
|
|
298
|
+
executionContext: result.executionContext
|
|
286
299
|
};
|
|
287
300
|
}
|
|
288
301
|
return null;
|
|
@@ -438,11 +451,17 @@ async function handleExec(params, context, deps) {
|
|
|
438
451
|
}
|
|
439
452
|
}
|
|
440
453
|
const effectiveTimeout = HTTP_EXEC_COMMANDS.has(commandBasename) ? Math.max(timeout, 3e5) : timeout;
|
|
454
|
+
const secretEnv = deps.secretResolver?.getSecretsForExec(
|
|
455
|
+
commandBasename,
|
|
456
|
+
args
|
|
457
|
+
) ?? {};
|
|
458
|
+
const injectedSecretNames = Object.keys(secretEnv);
|
|
459
|
+
const mergedEnv = injectedSecretNames.length > 0 ? { ...env || {}, ...secretEnv } : env;
|
|
441
460
|
const result = await executeCommand({
|
|
442
461
|
command: resolvedCommand,
|
|
443
462
|
args,
|
|
444
463
|
cwd: effectiveCwd,
|
|
445
|
-
env,
|
|
464
|
+
env: mergedEnv,
|
|
446
465
|
timeout: effectiveTimeout,
|
|
447
466
|
shell: false
|
|
448
467
|
// Always force shell: false to prevent injection
|
|
@@ -455,7 +474,8 @@ async function handleExec(params, context, deps) {
|
|
|
455
474
|
exitCode: result.exitCode,
|
|
456
475
|
allowed: true,
|
|
457
476
|
duration,
|
|
458
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
477
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
478
|
+
injectedSecretNames: injectedSecretNames.length > 0 ? injectedSecretNames : void 0
|
|
459
479
|
});
|
|
460
480
|
return {
|
|
461
481
|
success: true,
|
|
@@ -642,7 +662,6 @@ async function handlePing(params, context, deps) {
|
|
|
642
662
|
|
|
643
663
|
// libs/shield-broker/src/handlers/skill-install.ts
|
|
644
664
|
import * as fs2 from "node:fs/promises";
|
|
645
|
-
import * as fsSync from "node:fs";
|
|
646
665
|
import * as path3 from "node:path";
|
|
647
666
|
import { execSync } from "node:child_process";
|
|
648
667
|
function isValidSlug(slug) {
|
|
@@ -679,13 +698,14 @@ fi
|
|
|
679
698
|
}
|
|
680
699
|
async function handleSkillInstall(params, context, deps) {
|
|
681
700
|
const startTime = Date.now();
|
|
701
|
+
const warnings = [];
|
|
682
702
|
try {
|
|
683
703
|
const {
|
|
684
704
|
slug,
|
|
685
705
|
files,
|
|
686
706
|
createWrapper = true,
|
|
687
707
|
agentHome = process.env["AGENSHIELD_AGENT_HOME"] || "/Users/ash_default_agent",
|
|
688
|
-
socketGroup = process.env["AGENSHIELD_SOCKET_GROUP"] || "
|
|
708
|
+
socketGroup = process.env["AGENSHIELD_SOCKET_GROUP"] || "ash_default"
|
|
689
709
|
} = params;
|
|
690
710
|
if (!slug || !isValidSlug(slug)) {
|
|
691
711
|
return {
|
|
@@ -727,30 +747,11 @@ async function handleSkillInstall(params, context, deps) {
|
|
|
727
747
|
filesWritten++;
|
|
728
748
|
}
|
|
729
749
|
try {
|
|
730
|
-
execSync(`chown -R root:${socketGroup} "${skillDir}"`, { stdio: "pipe" });
|
|
731
750
|
execSync(`chmod -R a+rX,go-w "${skillDir}"`, { stdio: "pipe" });
|
|
732
751
|
} catch (err) {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
try {
|
|
737
|
-
let openclawConfig = {};
|
|
738
|
-
try {
|
|
739
|
-
const raw = fsSync.readFileSync(openclawConfigPath, "utf-8");
|
|
740
|
-
openclawConfig = JSON.parse(raw);
|
|
741
|
-
} catch {
|
|
742
|
-
}
|
|
743
|
-
if (!openclawConfig.skills) {
|
|
744
|
-
openclawConfig.skills = {};
|
|
745
|
-
}
|
|
746
|
-
const skills = openclawConfig.skills;
|
|
747
|
-
if (!skills.entries) {
|
|
748
|
-
skills.entries = {};
|
|
749
|
-
}
|
|
750
|
-
skills.entries[slug] = { enabled: true };
|
|
751
|
-
fsSync.writeFileSync(openclawConfigPath, JSON.stringify(openclawConfig, null, 2), "utf-8");
|
|
752
|
-
} catch (err) {
|
|
753
|
-
console.warn(`[SkillInstall] openclaw.json update failed: ${err.message}`);
|
|
752
|
+
const msg = `chmod on skill dir failed: ${err.message}`;
|
|
753
|
+
console.warn(`[SkillInstall] ${msg}`);
|
|
754
|
+
warnings.push(msg);
|
|
754
755
|
}
|
|
755
756
|
let wrapperPath;
|
|
756
757
|
if (createWrapper) {
|
|
@@ -758,12 +759,6 @@ async function handleSkillInstall(params, context, deps) {
|
|
|
758
759
|
await fs2.mkdir(binDir, { recursive: true });
|
|
759
760
|
const wrapperContent = createWrapperContent(slug, skillDir);
|
|
760
761
|
await fs2.writeFile(wrapperPath, wrapperContent, { mode: 493 });
|
|
761
|
-
try {
|
|
762
|
-
execSync(`chown root:${socketGroup} "${wrapperPath}"`, { stdio: "pipe" });
|
|
763
|
-
execSync(`chmod 755 "${wrapperPath}"`, { stdio: "pipe" });
|
|
764
|
-
} catch (err) {
|
|
765
|
-
console.warn(`[SkillInstall] wrapper chown failed: ${err.message}`);
|
|
766
|
-
}
|
|
767
762
|
}
|
|
768
763
|
return {
|
|
769
764
|
success: true,
|
|
@@ -771,7 +766,8 @@ async function handleSkillInstall(params, context, deps) {
|
|
|
771
766
|
installed: true,
|
|
772
767
|
skillDir,
|
|
773
768
|
wrapperPath,
|
|
774
|
-
filesWritten
|
|
769
|
+
filesWritten,
|
|
770
|
+
warnings: warnings.length > 0 ? warnings : void 0
|
|
775
771
|
},
|
|
776
772
|
audit: {
|
|
777
773
|
duration: Date.now() - startTime,
|
|
@@ -812,18 +808,6 @@ async function handleSkillUninstall(params, context, deps) {
|
|
|
812
808
|
if (skillExists) {
|
|
813
809
|
await fs2.rm(skillDir, { recursive: true, force: true });
|
|
814
810
|
}
|
|
815
|
-
const openclawConfigPath = path3.join(agentHome, ".openclaw", "openclaw.json");
|
|
816
|
-
try {
|
|
817
|
-
const raw = fsSync.readFileSync(openclawConfigPath, "utf-8");
|
|
818
|
-
const openclawConfig = JSON.parse(raw);
|
|
819
|
-
const skills = openclawConfig.skills;
|
|
820
|
-
const entries = skills?.entries;
|
|
821
|
-
if (entries?.[slug]) {
|
|
822
|
-
delete entries[slug];
|
|
823
|
-
fsSync.writeFileSync(openclawConfigPath, JSON.stringify(openclawConfig, null, 2), "utf-8");
|
|
824
|
-
}
|
|
825
|
-
} catch {
|
|
826
|
-
}
|
|
827
811
|
let wrapperRemoved = false;
|
|
828
812
|
if (removeWrapper) {
|
|
829
813
|
try {
|
|
@@ -855,7 +839,7 @@ async function handleSkillUninstall(params, context, deps) {
|
|
|
855
839
|
// libs/shield-broker/src/handlers/policy-check.ts
|
|
856
840
|
var DEFAULT_DAEMON_URL = "http://127.0.0.1:5200";
|
|
857
841
|
async function handlePolicyCheck(params, context, deps) {
|
|
858
|
-
const { operation, target } = params;
|
|
842
|
+
const { operation, target, context: execContext } = params;
|
|
859
843
|
if (!operation) {
|
|
860
844
|
return {
|
|
861
845
|
success: false,
|
|
@@ -895,9 +879,18 @@ async function handlePolicyCheck(params, context, deps) {
|
|
|
895
879
|
};
|
|
896
880
|
}
|
|
897
881
|
const daemonUrl = deps.daemonUrl || DEFAULT_DAEMON_URL;
|
|
898
|
-
const daemonResult = await forwardPolicyToDaemon(operation, target || "", daemonUrl);
|
|
882
|
+
const daemonResult = await forwardPolicyToDaemon(operation, target || "", daemonUrl, execContext);
|
|
899
883
|
if (daemonResult && daemonResult.allowed) {
|
|
900
|
-
return {
|
|
884
|
+
return {
|
|
885
|
+
success: true,
|
|
886
|
+
data: {
|
|
887
|
+
allowed: daemonResult.allowed,
|
|
888
|
+
policyId: daemonResult.policyId,
|
|
889
|
+
reason: daemonResult.reason,
|
|
890
|
+
sandbox: daemonResult.sandbox,
|
|
891
|
+
executionContext: daemonResult.executionContext
|
|
892
|
+
}
|
|
893
|
+
};
|
|
901
894
|
}
|
|
902
895
|
return {
|
|
903
896
|
success: true,
|
|
@@ -939,6 +932,7 @@ var UnixSocketServer = class {
|
|
|
939
932
|
policyEnforcer;
|
|
940
933
|
auditLogger;
|
|
941
934
|
secretVault;
|
|
935
|
+
secretResolver;
|
|
942
936
|
commandAllowlist;
|
|
943
937
|
connections = /* @__PURE__ */ new Set();
|
|
944
938
|
constructor(options) {
|
|
@@ -946,6 +940,7 @@ var UnixSocketServer = class {
|
|
|
946
940
|
this.policyEnforcer = options.policyEnforcer;
|
|
947
941
|
this.auditLogger = options.auditLogger;
|
|
948
942
|
this.secretVault = options.secretVault;
|
|
943
|
+
this.secretResolver = options.secretResolver;
|
|
949
944
|
this.commandAllowlist = options.commandAllowlist;
|
|
950
945
|
}
|
|
951
946
|
/**
|
|
@@ -1045,13 +1040,9 @@ var UnixSocketServer = class {
|
|
|
1045
1040
|
config: this.config
|
|
1046
1041
|
// Socket credentials would be extracted here on supported platforms
|
|
1047
1042
|
};
|
|
1048
|
-
const policyResult = await this.policyEnforcer.check(
|
|
1049
|
-
request.method,
|
|
1050
|
-
request.params,
|
|
1051
|
-
context
|
|
1052
|
-
);
|
|
1043
|
+
const policyResult = request.method === "policy_check" ? { allowed: true, policyId: void 0, reason: void 0 } : await this.policyEnforcer.check(request.method, request.params, context);
|
|
1053
1044
|
let finalPolicy = policyResult;
|
|
1054
|
-
if (!policyResult.allowed
|
|
1045
|
+
if (!policyResult.allowed) {
|
|
1055
1046
|
const target = this.extractTarget(request);
|
|
1056
1047
|
const daemonUrl = this.config.daemonUrl || "http://127.0.0.1:5200";
|
|
1057
1048
|
const override = await forwardPolicyToDaemon(request.method, target, daemonUrl);
|
|
@@ -1082,6 +1073,7 @@ var UnixSocketServer = class {
|
|
|
1082
1073
|
policyEnforcer: this.policyEnforcer,
|
|
1083
1074
|
auditLogger: this.auditLogger,
|
|
1084
1075
|
secretVault: this.secretVault,
|
|
1076
|
+
secretResolver: this.secretResolver,
|
|
1085
1077
|
commandAllowlist: this.commandAllowlist,
|
|
1086
1078
|
daemonUrl: this.config.daemonUrl
|
|
1087
1079
|
});
|
|
@@ -1298,13 +1290,9 @@ var HttpFallbackServer = class {
|
|
|
1298
1290
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1299
1291
|
config: this.config
|
|
1300
1292
|
};
|
|
1301
|
-
const policyResult = await this.policyEnforcer.check(
|
|
1302
|
-
request.method,
|
|
1303
|
-
request.params,
|
|
1304
|
-
context
|
|
1305
|
-
);
|
|
1293
|
+
const policyResult = request.method === "policy_check" ? { allowed: true, policyId: void 0, reason: void 0 } : await this.policyEnforcer.check(request.method, request.params, context);
|
|
1306
1294
|
let finalPolicy = policyResult;
|
|
1307
|
-
if (!policyResult.allowed
|
|
1295
|
+
if (!policyResult.allowed) {
|
|
1308
1296
|
const target = this.extractTarget(request);
|
|
1309
1297
|
const daemonUrl = this.config.daemonUrl || "http://127.0.0.1:5200";
|
|
1310
1298
|
const override = await forwardPolicyToDaemon(request.method, target, daemonUrl);
|
|
@@ -1414,6 +1402,7 @@ var PolicyEnforcer = class {
|
|
|
1414
1402
|
lastLoad = 0;
|
|
1415
1403
|
reloadInterval = 6e4;
|
|
1416
1404
|
// 1 minute
|
|
1405
|
+
verbose = process.env["AGENSHIELD_BROKER_VERBOSE"] === "true";
|
|
1417
1406
|
constructor(options) {
|
|
1418
1407
|
this.policiesPath = options.policiesPath;
|
|
1419
1408
|
this.failOpen = options.failOpen;
|
|
@@ -1501,13 +1490,17 @@ var PolicyEnforcer = class {
|
|
|
1501
1490
|
this.maybeReload();
|
|
1502
1491
|
try {
|
|
1503
1492
|
const target = this.extractTarget(operation, params);
|
|
1493
|
+
if (this.verbose) console.error(`[broker:enforcer] op=${operation} target=${target}`);
|
|
1504
1494
|
for (const rule of this.policies.rules) {
|
|
1505
1495
|
if (!rule.enabled) continue;
|
|
1506
1496
|
if (!rule.operations.includes(operation) && !rule.operations.includes("*")) {
|
|
1507
1497
|
continue;
|
|
1508
1498
|
}
|
|
1509
|
-
const matches = this.matchesPatterns(target, rule.patterns);
|
|
1499
|
+
const matches = this.matchesPatterns(target, rule.patterns, operation);
|
|
1510
1500
|
if (matches) {
|
|
1501
|
+
if (this.verbose) {
|
|
1502
|
+
console.error(`[broker:enforcer] MATCH rule=${rule.id} action=${rule.action} patterns=${rule.patterns.join(",")}`);
|
|
1503
|
+
}
|
|
1511
1504
|
if (rule.action === "deny" || rule.action === "approval") {
|
|
1512
1505
|
return {
|
|
1513
1506
|
allowed: false,
|
|
@@ -1532,6 +1525,9 @@ var PolicyEnforcer = class {
|
|
|
1532
1525
|
if (operation === "http_request" && this.policies.networkConstraints) {
|
|
1533
1526
|
return { allowed: true, reason: "Allowed by network constraints" };
|
|
1534
1527
|
}
|
|
1528
|
+
if (this.verbose) {
|
|
1529
|
+
console.error(`[broker:enforcer] DEFAULT action=${this.policies.defaultAction} (no rule matched)`);
|
|
1530
|
+
}
|
|
1535
1531
|
return {
|
|
1536
1532
|
allowed: this.policies.defaultAction === "allow",
|
|
1537
1533
|
reason: this.policies.defaultAction === "deny" ? "No matching allow policy" : void 0
|
|
@@ -1565,12 +1561,39 @@ var PolicyEnforcer = class {
|
|
|
1565
1561
|
return "";
|
|
1566
1562
|
}
|
|
1567
1563
|
}
|
|
1564
|
+
/**
|
|
1565
|
+
* Match a command target against a Claude Code-style command pattern.
|
|
1566
|
+
* See matchCommandPattern in daemon rpc.ts for full semantics.
|
|
1567
|
+
*/
|
|
1568
|
+
matchCommandPattern(pattern, target) {
|
|
1569
|
+
const trimmed = pattern.trim();
|
|
1570
|
+
if (trimmed === "*") return true;
|
|
1571
|
+
if (trimmed.endsWith(":*")) {
|
|
1572
|
+
const prefix = trimmed.slice(0, -2).toLowerCase();
|
|
1573
|
+
const lowerTarget = target.toLowerCase();
|
|
1574
|
+
if (lowerTarget === prefix || lowerTarget.startsWith(prefix + " ")) {
|
|
1575
|
+
return true;
|
|
1576
|
+
}
|
|
1577
|
+
const firstSpace = lowerTarget.indexOf(" ");
|
|
1578
|
+
const cmdPart = firstSpace >= 0 ? lowerTarget.slice(0, firstSpace) : lowerTarget;
|
|
1579
|
+
const lastSlash = cmdPart.lastIndexOf("/");
|
|
1580
|
+
if (lastSlash >= 0) {
|
|
1581
|
+
const basename3 = cmdPart.slice(lastSlash + 1);
|
|
1582
|
+
if (basename3 === prefix || basename3.startsWith(prefix + "-") || basename3.startsWith(prefix)) {
|
|
1583
|
+
return true;
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
return false;
|
|
1587
|
+
}
|
|
1588
|
+
return target.toLowerCase() === trimmed.toLowerCase();
|
|
1589
|
+
}
|
|
1568
1590
|
/**
|
|
1569
1591
|
* Check if target matches any patterns
|
|
1570
1592
|
*/
|
|
1571
|
-
matchesPatterns(target, patterns) {
|
|
1593
|
+
matchesPatterns(target, patterns, operation) {
|
|
1572
1594
|
for (const pattern of patterns) {
|
|
1573
|
-
|
|
1595
|
+
const isExec = operation === "exec" || operation === "*";
|
|
1596
|
+
if (isExec ? this.matchCommandPattern(pattern, target) : this.matchPattern(target, pattern)) {
|
|
1574
1597
|
return true;
|
|
1575
1598
|
}
|
|
1576
1599
|
}
|
|
@@ -1955,6 +1978,7 @@ function getDefaultPolicies(options) {
|
|
|
1955
1978
|
import * as fs5 from "node:fs";
|
|
1956
1979
|
import * as path5 from "node:path";
|
|
1957
1980
|
var BUILTIN_COMMANDS = {
|
|
1981
|
+
bash: ["/bin/bash", "/usr/bin/bash", "/opt/homebrew/bin/bash"],
|
|
1958
1982
|
git: ["/usr/bin/git", "/opt/homebrew/bin/git", "/usr/local/bin/git"],
|
|
1959
1983
|
ssh: ["/usr/bin/ssh"],
|
|
1960
1984
|
scp: ["/usr/bin/scp"],
|
|
@@ -2475,10 +2499,230 @@ var SecretVault = class {
|
|
|
2475
2499
|
}
|
|
2476
2500
|
};
|
|
2477
2501
|
|
|
2478
|
-
// libs/shield-broker/src/
|
|
2502
|
+
// libs/shield-broker/src/secrets/resolver.ts
|
|
2479
2503
|
import * as fs8 from "node:fs";
|
|
2504
|
+
var HTTP_COMMANDS = /* @__PURE__ */ new Set(["curl", "wget"]);
|
|
2505
|
+
var HTTP_FLAGS_WITH_VALUE2 = /* @__PURE__ */ new Set([
|
|
2506
|
+
"-X",
|
|
2507
|
+
"--request",
|
|
2508
|
+
"-H",
|
|
2509
|
+
"--header",
|
|
2510
|
+
"-d",
|
|
2511
|
+
"--data",
|
|
2512
|
+
"--data-raw",
|
|
2513
|
+
"--data-binary",
|
|
2514
|
+
"--data-urlencode",
|
|
2515
|
+
"-o",
|
|
2516
|
+
"--output",
|
|
2517
|
+
"-u",
|
|
2518
|
+
"--user",
|
|
2519
|
+
"-A",
|
|
2520
|
+
"--user-agent",
|
|
2521
|
+
"-e",
|
|
2522
|
+
"--referer",
|
|
2523
|
+
"-b",
|
|
2524
|
+
"--cookie",
|
|
2525
|
+
"-c",
|
|
2526
|
+
"--cookie-jar",
|
|
2527
|
+
"--connect-timeout",
|
|
2528
|
+
"--max-time",
|
|
2529
|
+
"-w",
|
|
2530
|
+
"--write-out",
|
|
2531
|
+
"-T",
|
|
2532
|
+
"--upload-file",
|
|
2533
|
+
"--resolve",
|
|
2534
|
+
"--cacert",
|
|
2535
|
+
"--cert",
|
|
2536
|
+
"--key"
|
|
2537
|
+
]);
|
|
2538
|
+
var SecretResolver = class {
|
|
2539
|
+
syncFilePath;
|
|
2540
|
+
synced = null;
|
|
2541
|
+
lastLoad = 0;
|
|
2542
|
+
reloadInterval = 3e4;
|
|
2543
|
+
// 30 seconds
|
|
2544
|
+
constructor(syncFilePath) {
|
|
2545
|
+
this.syncFilePath = syncFilePath;
|
|
2546
|
+
this.load();
|
|
2547
|
+
}
|
|
2548
|
+
/** Load synced secrets from disk */
|
|
2549
|
+
load() {
|
|
2550
|
+
if (!fs8.existsSync(this.syncFilePath)) {
|
|
2551
|
+
this.synced = null;
|
|
2552
|
+
this.lastLoad = Date.now();
|
|
2553
|
+
return;
|
|
2554
|
+
}
|
|
2555
|
+
try {
|
|
2556
|
+
const content = fs8.readFileSync(this.syncFilePath, "utf-8");
|
|
2557
|
+
this.synced = JSON.parse(content);
|
|
2558
|
+
this.lastLoad = Date.now();
|
|
2559
|
+
} catch {
|
|
2560
|
+
this.synced = null;
|
|
2561
|
+
this.lastLoad = Date.now();
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
maybeReload() {
|
|
2565
|
+
if (Date.now() - this.lastLoad > this.reloadInterval) {
|
|
2566
|
+
this.load();
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
/**
|
|
2570
|
+
* Get environment variables to inject for an exec operation.
|
|
2571
|
+
* Returns global secrets + any secrets from policies whose patterns match.
|
|
2572
|
+
*/
|
|
2573
|
+
getSecretsForExec(command, args) {
|
|
2574
|
+
this.maybeReload();
|
|
2575
|
+
if (!this.synced) return {};
|
|
2576
|
+
const result = { ...this.synced.globalSecrets };
|
|
2577
|
+
for (const binding of this.synced.policyBindings) {
|
|
2578
|
+
let matched = false;
|
|
2579
|
+
if (binding.target === "url" && HTTP_COMMANDS.has(command)) {
|
|
2580
|
+
const url = this.extractUrlFromArgs(args);
|
|
2581
|
+
if (url) {
|
|
2582
|
+
matched = binding.patterns.some((p) => this.matchUrlPattern(p, url));
|
|
2583
|
+
}
|
|
2584
|
+
} else if (binding.target === "command") {
|
|
2585
|
+
const fullCommand = args.length > 0 ? `${command} ${args.join(" ")}` : command;
|
|
2586
|
+
matched = binding.patterns.some((p) => this.matchCommandPattern(p, fullCommand));
|
|
2587
|
+
}
|
|
2588
|
+
if (matched) {
|
|
2589
|
+
Object.assign(result, binding.secrets);
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
return result;
|
|
2593
|
+
}
|
|
2594
|
+
/**
|
|
2595
|
+
* Get names of secrets that would be injected (for audit logging — names only, never values).
|
|
2596
|
+
*/
|
|
2597
|
+
getSecretNamesForExec(command, args) {
|
|
2598
|
+
return Object.keys(this.getSecretsForExec(command, args));
|
|
2599
|
+
}
|
|
2600
|
+
// --- URL matching (replicated from daemon rpc.ts) ---
|
|
2601
|
+
normalizeUrlBase(pattern) {
|
|
2602
|
+
let p = pattern.trim();
|
|
2603
|
+
p = p.replace(/\/+$/, "");
|
|
2604
|
+
if (!p.match(/^(\*|https?):\/\//i)) {
|
|
2605
|
+
p = `https://${p}`;
|
|
2606
|
+
}
|
|
2607
|
+
return p;
|
|
2608
|
+
}
|
|
2609
|
+
normalizeUrlTarget(url) {
|
|
2610
|
+
const trimmed = url.trim();
|
|
2611
|
+
try {
|
|
2612
|
+
const parsed = new URL(trimmed);
|
|
2613
|
+
let urlPath = parsed.pathname;
|
|
2614
|
+
if (urlPath.length > 1) {
|
|
2615
|
+
urlPath = urlPath.replace(/\/+$/, "");
|
|
2616
|
+
}
|
|
2617
|
+
return `${parsed.protocol}//${parsed.host}${urlPath}${parsed.search}`;
|
|
2618
|
+
} catch {
|
|
2619
|
+
return trimmed.replace(/\/+$/, "");
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
globToRegex(pattern) {
|
|
2623
|
+
const regexPattern = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/\?/g, ".").replace(/{{GLOBSTAR}}/g, ".*");
|
|
2624
|
+
return new RegExp(`^${regexPattern}$`, "i");
|
|
2625
|
+
}
|
|
2626
|
+
matchUrlPattern(pattern, target) {
|
|
2627
|
+
const base = this.normalizeUrlBase(pattern);
|
|
2628
|
+
const trimmed = pattern.trim().replace(/\/+$/, "");
|
|
2629
|
+
const effectiveTarget = this.normalizeUrlTarget(target);
|
|
2630
|
+
if (trimmed.endsWith("*")) {
|
|
2631
|
+
return this.globToRegex(base).test(effectiveTarget);
|
|
2632
|
+
}
|
|
2633
|
+
return this.globToRegex(base).test(effectiveTarget) || this.globToRegex(`${base}/**`).test(effectiveTarget);
|
|
2634
|
+
}
|
|
2635
|
+
// --- Command matching (replicated from daemon rpc.ts) ---
|
|
2636
|
+
matchCommandPattern(pattern, target) {
|
|
2637
|
+
const trimmed = pattern.trim();
|
|
2638
|
+
if (trimmed === "*") return true;
|
|
2639
|
+
if (trimmed.endsWith(":*")) {
|
|
2640
|
+
const prefix = trimmed.slice(0, -2);
|
|
2641
|
+
const lowerTarget = target.toLowerCase();
|
|
2642
|
+
const lowerPrefix = prefix.toLowerCase();
|
|
2643
|
+
return lowerTarget === lowerPrefix || lowerTarget.startsWith(lowerPrefix + " ");
|
|
2644
|
+
}
|
|
2645
|
+
return target.toLowerCase() === trimmed.toLowerCase();
|
|
2646
|
+
}
|
|
2647
|
+
// --- URL extraction from curl/wget args ---
|
|
2648
|
+
extractUrlFromArgs(args) {
|
|
2649
|
+
for (let i = 0; i < args.length; i++) {
|
|
2650
|
+
const arg = args[i];
|
|
2651
|
+
if (arg.startsWith("-")) {
|
|
2652
|
+
if (HTTP_FLAGS_WITH_VALUE2.has(arg)) {
|
|
2653
|
+
i++;
|
|
2654
|
+
}
|
|
2655
|
+
continue;
|
|
2656
|
+
}
|
|
2657
|
+
return arg;
|
|
2658
|
+
}
|
|
2659
|
+
return null;
|
|
2660
|
+
}
|
|
2661
|
+
};
|
|
2662
|
+
|
|
2663
|
+
// libs/shield-integrations/dist/index.js
|
|
2664
|
+
import { exec as exec2, spawn as spawn2 } from "node:child_process";
|
|
2665
|
+
import { promisify as promisify2 } from "node:util";
|
|
2666
|
+
import { exec as exec22, execSync as execSync2, spawn as spawn22 } from "node:child_process";
|
|
2667
|
+
import { promisify as promisify22 } from "node:util";
|
|
2668
|
+
import * as fs32 from "node:fs/promises";
|
|
2669
|
+
import { exec as exec3 } from "node:child_process";
|
|
2670
|
+
import { promisify as promisify3 } from "node:util";
|
|
2671
|
+
var execAsync2 = promisify2(exec2);
|
|
2672
|
+
var execAsync22 = promisify22(exec22);
|
|
2673
|
+
var execAsync3 = promisify3(exec3);
|
|
2674
|
+
var OPENCLAW_GATEWAY_LABEL = "com.agenshield.openclaw.gateway";
|
|
2675
|
+
var OPENCLAW_GATEWAY_PLIST = "/Library/LaunchDaemons/com.agenshield.openclaw.gateway.plist";
|
|
2676
|
+
async function startOpenClawServices() {
|
|
2677
|
+
try {
|
|
2678
|
+
try {
|
|
2679
|
+
await execAsync3(`sudo launchctl kickstart system/${OPENCLAW_GATEWAY_LABEL}`);
|
|
2680
|
+
} catch {
|
|
2681
|
+
}
|
|
2682
|
+
return {
|
|
2683
|
+
success: true,
|
|
2684
|
+
message: "OpenClaw gateway started"
|
|
2685
|
+
};
|
|
2686
|
+
} catch (error) {
|
|
2687
|
+
return {
|
|
2688
|
+
success: false,
|
|
2689
|
+
message: `Failed to start OpenClaw gateway: ${error.message}`,
|
|
2690
|
+
error
|
|
2691
|
+
};
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
async function stopOpenClawServices() {
|
|
2695
|
+
try {
|
|
2696
|
+
try {
|
|
2697
|
+
await execAsync3(`sudo launchctl kill SIGTERM system/${OPENCLAW_GATEWAY_LABEL}`);
|
|
2698
|
+
} catch {
|
|
2699
|
+
}
|
|
2700
|
+
return {
|
|
2701
|
+
success: true,
|
|
2702
|
+
message: "OpenClaw gateway stopped"
|
|
2703
|
+
};
|
|
2704
|
+
} catch (error) {
|
|
2705
|
+
return {
|
|
2706
|
+
success: false,
|
|
2707
|
+
message: `Failed to stop OpenClaw gateway: ${error.message}`,
|
|
2708
|
+
error
|
|
2709
|
+
};
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
async function isOpenClawInstalled() {
|
|
2713
|
+
try {
|
|
2714
|
+
await fs32.access(OPENCLAW_GATEWAY_PLIST);
|
|
2715
|
+
return true;
|
|
2716
|
+
} catch {
|
|
2717
|
+
return false;
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
// libs/shield-broker/src/main.ts
|
|
2722
|
+
import * as fs9 from "node:fs";
|
|
2480
2723
|
import * as path7 from "node:path";
|
|
2481
2724
|
var PROXIED_COMMANDS = [
|
|
2725
|
+
"bash",
|
|
2482
2726
|
"curl",
|
|
2483
2727
|
"wget",
|
|
2484
2728
|
"git",
|
|
@@ -2497,9 +2741,9 @@ var PROXIED_COMMANDS = [
|
|
|
2497
2741
|
function loadConfig() {
|
|
2498
2742
|
const configPath = process.env["AGENSHIELD_CONFIG"] || "/opt/agenshield/config/shield.json";
|
|
2499
2743
|
let fileConfig = {};
|
|
2500
|
-
if (
|
|
2744
|
+
if (fs9.existsSync(configPath)) {
|
|
2501
2745
|
try {
|
|
2502
|
-
const content =
|
|
2746
|
+
const content = fs9.readFileSync(configPath, "utf-8");
|
|
2503
2747
|
fileConfig = JSON.parse(content);
|
|
2504
2748
|
} catch (error) {
|
|
2505
2749
|
console.warn(`Warning: Failed to load config from ${configPath}:`, error);
|
|
@@ -2519,8 +2763,8 @@ function loadConfig() {
|
|
|
2519
2763
|
logLevel: process.env["AGENSHIELD_LOG_LEVEL"] || fileConfig.logLevel || "info",
|
|
2520
2764
|
failOpen: process.env["AGENSHIELD_FAIL_OPEN"] === "true" || (fileConfig.failOpen ?? false),
|
|
2521
2765
|
socketMode: fileConfig.socketMode || 438,
|
|
2522
|
-
socketOwner: fileConfig.socketOwner || "
|
|
2523
|
-
socketGroup: fileConfig.socketGroup || "
|
|
2766
|
+
socketOwner: fileConfig.socketOwner || "ash_default_broker",
|
|
2767
|
+
socketGroup: fileConfig.socketGroup || "ash_default",
|
|
2524
2768
|
agentHome: process.env["AGENSHIELD_AGENT_HOME"] || fileConfig.agentHome,
|
|
2525
2769
|
daemonUrl: process.env["AGENSHIELD_DAEMON_URL"] || fileConfig.daemonUrl || "http://127.0.0.1:5200"
|
|
2526
2770
|
};
|
|
@@ -2529,9 +2773,9 @@ function ensureDirectories(config) {
|
|
|
2529
2773
|
const socketDir = path7.dirname(config.socketPath);
|
|
2530
2774
|
const auditDir = path7.dirname(config.auditLogPath);
|
|
2531
2775
|
for (const dir of [socketDir, auditDir, config.policiesPath]) {
|
|
2532
|
-
if (!
|
|
2776
|
+
if (!fs9.existsSync(dir)) {
|
|
2533
2777
|
try {
|
|
2534
|
-
|
|
2778
|
+
fs9.mkdirSync(dir, { recursive: true, mode: 493 });
|
|
2535
2779
|
} catch (error) {
|
|
2536
2780
|
if (error.code !== "EEXIST") {
|
|
2537
2781
|
console.warn(`Warning: Could not create directory ${dir}:`, error);
|
|
@@ -2541,23 +2785,23 @@ function ensureDirectories(config) {
|
|
|
2541
2785
|
}
|
|
2542
2786
|
}
|
|
2543
2787
|
function ensureProxiedCommandWrappers(binDir) {
|
|
2544
|
-
if (!
|
|
2788
|
+
if (!fs9.existsSync(binDir)) {
|
|
2545
2789
|
try {
|
|
2546
|
-
|
|
2790
|
+
fs9.mkdirSync(binDir, { recursive: true, mode: 493 });
|
|
2547
2791
|
} catch {
|
|
2548
2792
|
console.warn(`[broker] cannot create bin dir ${binDir}`);
|
|
2549
2793
|
return;
|
|
2550
2794
|
}
|
|
2551
2795
|
}
|
|
2552
2796
|
const shieldExecPath = "/opt/agenshield/bin/shield-exec";
|
|
2553
|
-
const hasShieldExec =
|
|
2797
|
+
const hasShieldExec = fs9.existsSync(shieldExecPath);
|
|
2554
2798
|
let installed = 0;
|
|
2555
2799
|
for (const cmd of PROXIED_COMMANDS) {
|
|
2556
2800
|
const wrapperPath = path7.join(binDir, cmd);
|
|
2557
|
-
if (
|
|
2801
|
+
if (fs9.existsSync(wrapperPath)) continue;
|
|
2558
2802
|
if (hasShieldExec) {
|
|
2559
2803
|
try {
|
|
2560
|
-
|
|
2804
|
+
fs9.symlinkSync(shieldExecPath, wrapperPath);
|
|
2561
2805
|
installed++;
|
|
2562
2806
|
continue;
|
|
2563
2807
|
} catch {
|
|
@@ -2571,7 +2815,7 @@ function ensureProxiedCommandWrappers(binDir) {
|
|
|
2571
2815
|
`exec /opt/agenshield/bin/shield-client exec ${cmd} "$@"`,
|
|
2572
2816
|
""
|
|
2573
2817
|
].join("\n");
|
|
2574
|
-
|
|
2818
|
+
fs9.writeFileSync(wrapperPath, script, { mode: 493 });
|
|
2575
2819
|
installed++;
|
|
2576
2820
|
} catch {
|
|
2577
2821
|
console.warn(`[broker] cannot write wrapper for ${cmd}`);
|
|
@@ -2622,6 +2866,12 @@ async function main() {
|
|
|
2622
2866
|
const commandAllowlist = new CommandAllowlist(
|
|
2623
2867
|
"/opt/agenshield/config/allowed-commands.json"
|
|
2624
2868
|
);
|
|
2869
|
+
const secretResolver = new SecretResolver(
|
|
2870
|
+
path7.join(
|
|
2871
|
+
path7.dirname(config.configPath || "/opt/agenshield/config/shield.json"),
|
|
2872
|
+
"synced-secrets.json"
|
|
2873
|
+
)
|
|
2874
|
+
);
|
|
2625
2875
|
if (config.agentHome) {
|
|
2626
2876
|
ensureProxiedCommandWrappers(path7.join(config.agentHome, "bin"));
|
|
2627
2877
|
}
|
|
@@ -2630,6 +2880,7 @@ async function main() {
|
|
|
2630
2880
|
policyEnforcer,
|
|
2631
2881
|
auditLogger,
|
|
2632
2882
|
secretVault,
|
|
2883
|
+
secretResolver,
|
|
2633
2884
|
commandAllowlist
|
|
2634
2885
|
});
|
|
2635
2886
|
await socketServer.start();
|
|
@@ -2645,9 +2896,29 @@ async function main() {
|
|
|
2645
2896
|
await httpServer.start();
|
|
2646
2897
|
console.log(`HTTP fallback server listening on ${config.httpHost}:${config.httpPort}`);
|
|
2647
2898
|
}
|
|
2899
|
+
try {
|
|
2900
|
+
if (await isOpenClawInstalled()) {
|
|
2901
|
+
console.log("OpenClaw LaunchDaemons detected, starting services...");
|
|
2902
|
+
const clawResult = await startOpenClawServices();
|
|
2903
|
+
if (clawResult.success) {
|
|
2904
|
+
console.log("OpenClaw services started.");
|
|
2905
|
+
} else {
|
|
2906
|
+
console.warn(`OpenClaw start warning: ${clawResult.message}`);
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
} catch (err) {
|
|
2910
|
+
console.warn("Warning: Failed to start OpenClaw services:", err);
|
|
2911
|
+
}
|
|
2648
2912
|
const shutdown = async (signal) => {
|
|
2649
2913
|
console.log(`
|
|
2650
2914
|
Received ${signal}, shutting down...`);
|
|
2915
|
+
try {
|
|
2916
|
+
if (await isOpenClawInstalled()) {
|
|
2917
|
+
console.log("Stopping OpenClaw services...");
|
|
2918
|
+
await stopOpenClawServices();
|
|
2919
|
+
}
|
|
2920
|
+
} catch {
|
|
2921
|
+
}
|
|
2651
2922
|
await socketServer.stop();
|
|
2652
2923
|
if (httpServer) {
|
|
2653
2924
|
await httpServer.stop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenshield/broker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AgenShield broker daemon with Unix socket and HTTP fallback",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@agenshield/
|
|
27
|
+
"@agenshield/integrations": "0.7.0",
|
|
28
|
+
"@agenshield/ipc": "0.7.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@types/node": "^24.0.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-allowlist.d.ts","sourceRoot":"","sources":["../../src/policies/command-allowlist.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"command-allowlist.d.ts","sourceRoot":"","sources":["../../src/policies/command-allowlist.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAkDD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAA0C;IACjE,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,cAAc,CAAiB;gBAE3B,UAAU,EAAE,MAAM;IAK9B;;OAEG;IACH,IAAI,IAAI,IAAI;IAqBZ;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,IAAI,IAAI,IAAI;IAcZ;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI;IAK9B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAQ7B;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI7C;;OAEG;IACH,IAAI,IAAI,KAAK,CAAC,cAAc,GAAG;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAsBpD;;OAEG;IACH,WAAW,IAAI,cAAc,EAAE;IAI/B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIhC;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CA0CxC"}
|
package/policies/enforcer.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare class PolicyEnforcer {
|
|
|
53
53
|
private failOpen;
|
|
54
54
|
private lastLoad;
|
|
55
55
|
private reloadInterval;
|
|
56
|
+
private verbose;
|
|
56
57
|
constructor(options: PolicyEnforcerOptions);
|
|
57
58
|
/**
|
|
58
59
|
* Normalize a policy rule — infer operations from target when missing,
|
|
@@ -75,6 +76,11 @@ export declare class PolicyEnforcer {
|
|
|
75
76
|
* Extract target from operation params
|
|
76
77
|
*/
|
|
77
78
|
private extractTarget;
|
|
79
|
+
/**
|
|
80
|
+
* Match a command target against a Claude Code-style command pattern.
|
|
81
|
+
* See matchCommandPattern in daemon rpc.ts for full semantics.
|
|
82
|
+
*/
|
|
83
|
+
private matchCommandPattern;
|
|
78
84
|
/**
|
|
79
85
|
* Check if target matches any patterns
|
|
80
86
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enforcer.d.ts","sourceRoot":"","sources":["../../src/policies/enforcer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IACtC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACpC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,GAAG,MAAM,CA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AO,CAAC,gBAAgB;IA8GxB;;OAEG;IACH,WAAW,IAAI,YAAY;IAK3B;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAK/B;;OAEG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;CAQhC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret Resolver
|
|
3
|
+
*
|
|
4
|
+
* Reads synced-secrets.json (written by the daemon) and resolves which
|
|
5
|
+
* secrets should be injected as environment variables for each exec operation.
|
|
6
|
+
*
|
|
7
|
+
* - Global secrets (policyIds=[]) are always injected
|
|
8
|
+
* - Policy-linked secrets are injected when the policy's patterns match
|
|
9
|
+
* the command being executed
|
|
10
|
+
*
|
|
11
|
+
* Auto-reloads from disk every 30 seconds (same pattern as CommandAllowlist).
|
|
12
|
+
*/
|
|
13
|
+
export declare class SecretResolver {
|
|
14
|
+
private syncFilePath;
|
|
15
|
+
private synced;
|
|
16
|
+
private lastLoad;
|
|
17
|
+
private reloadInterval;
|
|
18
|
+
constructor(syncFilePath: string);
|
|
19
|
+
/** Load synced secrets from disk */
|
|
20
|
+
private load;
|
|
21
|
+
private maybeReload;
|
|
22
|
+
/**
|
|
23
|
+
* Get environment variables to inject for an exec operation.
|
|
24
|
+
* Returns global secrets + any secrets from policies whose patterns match.
|
|
25
|
+
*/
|
|
26
|
+
getSecretsForExec(command: string, args: string[]): Record<string, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Get names of secrets that would be injected (for audit logging — names only, never values).
|
|
29
|
+
*/
|
|
30
|
+
getSecretNamesForExec(command: string, args: string[]): string[];
|
|
31
|
+
private normalizeUrlBase;
|
|
32
|
+
private normalizeUrlTarget;
|
|
33
|
+
private globToRegex;
|
|
34
|
+
private matchUrlPattern;
|
|
35
|
+
private matchCommandPattern;
|
|
36
|
+
private extractUrlFromArgs;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/secrets/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA0CH,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,cAAc,CAAiB;gBAE3B,YAAY,EAAE,MAAM;IAKhC,oCAAoC;IACpC,OAAO,CAAC,IAAI;IAgBZ,OAAO,CAAC,WAAW;IAMnB;;;OAGG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IA8B1E;;OAEG;IACH,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAMhE,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,kBAAkB;CAa3B"}
|
package/server.d.ts
CHANGED
|
@@ -8,12 +8,14 @@ import type { BrokerConfig } from './types.js';
|
|
|
8
8
|
import type { PolicyEnforcer } from './policies/enforcer.js';
|
|
9
9
|
import type { AuditLogger } from './audit/logger.js';
|
|
10
10
|
import type { SecretVault } from './secrets/vault.js';
|
|
11
|
+
import type { SecretResolver } from './secrets/resolver.js';
|
|
11
12
|
import type { CommandAllowlist } from './policies/command-allowlist.js';
|
|
12
13
|
export interface UnixSocketServerOptions {
|
|
13
14
|
config: BrokerConfig;
|
|
14
15
|
policyEnforcer: PolicyEnforcer;
|
|
15
16
|
auditLogger: AuditLogger;
|
|
16
17
|
secretVault: SecretVault;
|
|
18
|
+
secretResolver?: SecretResolver;
|
|
17
19
|
commandAllowlist: CommandAllowlist;
|
|
18
20
|
}
|
|
19
21
|
export declare class UnixSocketServer {
|
|
@@ -22,6 +24,7 @@ export declare class UnixSocketServer {
|
|
|
22
24
|
private policyEnforcer;
|
|
23
25
|
private auditLogger;
|
|
24
26
|
private secretVault;
|
|
27
|
+
private secretResolver?;
|
|
25
28
|
private commandAllowlist;
|
|
26
29
|
private connections;
|
|
27
30
|
constructor(options: UnixSocketServerOptions);
|
package/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAIxE,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,WAAW,CAA8B;gBAErC,OAAO,EAAE,uBAAuB;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA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|
|
|
269
269
|
wrapperPath?: string;
|
|
270
270
|
/** Number of files written */
|
|
271
271
|
filesWritten: number;
|
|
272
|
+
/** Non-fatal warnings (e.g., chown failures in dev) */
|
|
273
|
+
warnings?: string[];
|
|
272
274
|
}
|
|
273
275
|
export interface SkillUninstallParams {
|
|
274
276
|
/** Skill slug to uninstall */
|
package/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAc,aAAa,EAAqC,MAAM,iBAAiB,CAAC;AAEpG;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IAEnB,uCAAuC;IACvC,WAAW,EAAE,OAAO,CAAC;IAErB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IAEjB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IAEjB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IAEnB,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;IAErB,wBAAwB;IACxB,YAAY,EAAE,MAAM,CAAC;IAErB,gBAAgB;IAChB,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAE9C,iDAAiD;IACjD,QAAQ,EAAE,OAAO,CAAC;IAElB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IAEnB,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAElB,oCA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