@agenshield/broker 0.6.0 → 0.6.1

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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Daemon Policy Forwarding
3
+ *
4
+ * Shared module for forwarding policy checks to the daemon's RPC endpoint.
5
+ * Used by both the policy_check handler and the top-level processRequest()
6
+ * in server.ts / http-fallback.ts when the broker's local enforcer denies
7
+ * a request but the daemon may have a user-defined policy that allows it.
8
+ */
9
+ export interface DaemonPolicyResult {
10
+ allowed: boolean;
11
+ policyId?: string;
12
+ reason?: string;
13
+ }
14
+ /**
15
+ * Forward a policy check to the daemon's RPC endpoint.
16
+ *
17
+ * The daemon evaluates user-defined policies (created in the UI).
18
+ * We only accept the daemon's result if it returns `allowed: true`
19
+ * AND includes a `policyId` (explicit user policy match).
20
+ * A default-allow (no policyId) is NOT trusted — we keep the broker denial.
21
+ *
22
+ * @returns The daemon's result if it explicitly allows, or null to keep broker denial.
23
+ */
24
+ export declare function forwardPolicyToDaemon(operation: string, target: string, daemonUrl: string): Promise<DaemonPolicyResult | null>;
25
+ //# sourceMappingURL=daemon-forward.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon-forward.d.ts","sourceRoot":"","sources":["../src/daemon-forward.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAiDpC"}
@@ -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;AA+FtD,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,CA0GpC"}
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,CA+GpC"}
@@ -4,6 +4,9 @@
4
4
  * Handles policy_check RPC calls from the interceptor.
5
5
  * The interceptor sends { operation, target } and this handler
6
6
  * evaluates the inner operation against the policy enforcer.
7
+ *
8
+ * If the broker's enforcer denies the request, we forward to the
9
+ * daemon's RPC endpoint which checks user-defined policies.
7
10
  */
8
11
  import type { HandlerContext, HandlerResult } from '../types.js';
9
12
  import type { HandlerDependencies } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"policy-check.d.ts","sourceRoot":"","sources":["../../src/handlers/policy-check.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAOtD,UAAU,qBAAqB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,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,CA6C/C"}
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;AAQtD,UAAU,qBAAqB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;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,CAoE/C"}
@@ -24,5 +24,6 @@ export interface HandlerDependencies {
24
24
  commandAllowlist: CommandAllowlist;
25
25
  onExecMonitor?: (event: ExecMonitorEvent) => void;
26
26
  onExecDenied?: (command: string, reason: string) => void;
27
+ daemonUrl?: string;
27
28
  }
28
29
  //# sourceMappingURL=types.d.ts.map
@@ -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;AA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E,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,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"}
@@ -7,16 +7,19 @@
7
7
  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
+ import type { CommandAllowlist } from './policies/command-allowlist.js';
10
11
  export interface HttpFallbackServerOptions {
11
12
  config: BrokerConfig;
12
13
  policyEnforcer: PolicyEnforcer;
13
14
  auditLogger: AuditLogger;
15
+ commandAllowlist: CommandAllowlist;
14
16
  }
15
17
  export declare class HttpFallbackServer {
16
18
  private server;
17
19
  private config;
18
20
  private policyEnforcer;
19
21
  private auditLogger;
22
+ private commandAllowlist;
20
23
  constructor(options: HttpFallbackServerOptions);
21
24
  /**
22
25
  * Start the HTTP fallback server
@@ -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;AAqBrD,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,YAA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mB;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;IAuI5B;;OAEG;IACH,OAAO,CAAC,UAAU;IAsBlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAWrB;;OAEG;IACH,OAAO,CAAC,aAAa;CAWtB"}
package/index.js CHANGED
@@ -249,6 +249,47 @@ function matchPattern(name, pattern) {
249
249
  // libs/shield-broker/src/handlers/exec.ts
250
250
  import * as path2 from "node:path";
251
251
  import { spawn } from "node:child_process";
252
+
253
+ // libs/shield-broker/src/daemon-forward.ts
254
+ var DAEMON_RPC_TIMEOUT = 2e3;
255
+ async function forwardPolicyToDaemon(operation, target, daemonUrl) {
256
+ try {
257
+ const controller = new AbortController();
258
+ const timeout = setTimeout(() => controller.abort(), DAEMON_RPC_TIMEOUT);
259
+ const response = await fetch(`${daemonUrl}/rpc`, {
260
+ method: "POST",
261
+ headers: { "Content-Type": "application/json" },
262
+ body: JSON.stringify({
263
+ jsonrpc: "2.0",
264
+ id: `broker-fwd-${Date.now()}`,
265
+ method: "policy_check",
266
+ params: { operation, target }
267
+ }),
268
+ signal: controller.signal
269
+ });
270
+ clearTimeout(timeout);
271
+ if (!response.ok) {
272
+ return null;
273
+ }
274
+ const json = await response.json();
275
+ if (json.error || !json.result) {
276
+ return null;
277
+ }
278
+ const result = json.result;
279
+ if (result.policyId) {
280
+ return {
281
+ allowed: !!result.allowed,
282
+ policyId: result.policyId,
283
+ reason: result.reason
284
+ };
285
+ }
286
+ return null;
287
+ } catch {
288
+ return null;
289
+ }
290
+ }
291
+
292
+ // libs/shield-broker/src/handlers/exec.ts
252
293
  var MAX_OUTPUT_SIZE = 10 * 1024 * 1024;
253
294
  var DEFAULT_WORKSPACE = "/Users/clawagent/workspace";
254
295
  var FS_COMMANDS = /* @__PURE__ */ new Set([
@@ -381,12 +422,16 @@ async function handleExec(params, context, deps) {
381
422
  if (url) {
382
423
  const networkCheck = await deps.policyEnforcer.check("http_request", { url }, context);
383
424
  if (!networkCheck.allowed) {
384
- const reason = `URL not allowed: ${url} - ${networkCheck.reason}`;
385
- deps.onExecDenied?.(command, reason);
386
- return {
387
- success: false,
388
- error: { code: 1009, message: reason }
389
- };
425
+ const daemonUrl = deps.daemonUrl || "http://127.0.0.1:5200";
426
+ const override = await forwardPolicyToDaemon("http_request", url, daemonUrl);
427
+ if (!override || !override.allowed) {
428
+ const reason = `URL not allowed: ${url} - ${networkCheck.reason}`;
429
+ deps.onExecDenied?.(command, reason);
430
+ return {
431
+ success: false,
432
+ error: { code: 1009, message: reason }
433
+ };
434
+ }
390
435
  }
391
436
  }
392
437
  }
@@ -806,6 +851,7 @@ async function handleSkillUninstall(params, context, deps) {
806
851
  }
807
852
 
808
853
  // libs/shield-broker/src/handlers/policy-check.ts
854
+ var DEFAULT_DAEMON_URL = "http://127.0.0.1:5200";
809
855
  async function handlePolicyCheck(params, context, deps) {
810
856
  const { operation, target } = params;
811
857
  if (!operation) {
@@ -836,10 +882,25 @@ async function handlePolicyCheck(params, context, deps) {
836
882
  break;
837
883
  }
838
884
  const result = await deps.policyEnforcer.check(operation, checkParams, context);
885
+ if (result.allowed) {
886
+ return {
887
+ success: true,
888
+ data: {
889
+ allowed: true,
890
+ policyId: result.policyId,
891
+ reason: result.reason
892
+ }
893
+ };
894
+ }
895
+ const daemonUrl = deps.daemonUrl || DEFAULT_DAEMON_URL;
896
+ const daemonResult = await forwardPolicyToDaemon(operation, target || "", daemonUrl);
897
+ if (daemonResult && daemonResult.allowed) {
898
+ return { success: true, data: daemonResult };
899
+ }
839
900
  return {
840
901
  success: true,
841
902
  data: {
842
- allowed: result.allowed,
903
+ allowed: false,
843
904
  policyId: result.policyId,
844
905
  reason: result.reason
845
906
  }
@@ -876,12 +937,14 @@ var UnixSocketServer = class {
876
937
  policyEnforcer;
877
938
  auditLogger;
878
939
  secretVault;
940
+ commandAllowlist;
879
941
  connections = /* @__PURE__ */ new Set();
880
942
  constructor(options) {
881
943
  this.config = options.config;
882
944
  this.policyEnforcer = options.policyEnforcer;
883
945
  this.auditLogger = options.auditLogger;
884
946
  this.secretVault = options.secretVault;
947
+ this.commandAllowlist = options.commandAllowlist;
885
948
  }
886
949
  /**
887
950
  * Start the Unix socket server
@@ -985,20 +1048,29 @@ var UnixSocketServer = class {
985
1048
  request.params,
986
1049
  context
987
1050
  );
988
- if (!policyResult.allowed) {
1051
+ let finalPolicy = policyResult;
1052
+ if (!policyResult.allowed && request.method !== "policy_check") {
1053
+ const target = this.extractTarget(request);
1054
+ const daemonUrl = this.config.daemonUrl || "http://127.0.0.1:5200";
1055
+ const override = await forwardPolicyToDaemon(request.method, target, daemonUrl);
1056
+ if (override) {
1057
+ finalPolicy = override;
1058
+ }
1059
+ }
1060
+ if (!finalPolicy.allowed) {
989
1061
  await this.auditLogger.log({
990
1062
  id: requestId,
991
1063
  timestamp: /* @__PURE__ */ new Date(),
992
1064
  operation: request.method,
993
1065
  channel: "socket",
994
1066
  allowed: false,
995
- policyId: policyResult.policyId,
1067
+ policyId: finalPolicy.policyId,
996
1068
  target: this.extractTarget(request),
997
1069
  result: "denied",
998
- errorMessage: policyResult.reason,
1070
+ errorMessage: finalPolicy.reason,
999
1071
  durationMs: Date.now() - startTime
1000
1072
  });
1001
- return this.errorResponse(request.id, 1001, policyResult.reason || "Policy denied");
1073
+ return this.errorResponse(request.id, 1001, finalPolicy.reason || "Policy denied");
1002
1074
  }
1003
1075
  const handler = this.getHandler(request.method);
1004
1076
  if (!handler) {
@@ -1007,7 +1079,9 @@ var UnixSocketServer = class {
1007
1079
  const result = await handler(request.params, context, {
1008
1080
  policyEnforcer: this.policyEnforcer,
1009
1081
  auditLogger: this.auditLogger,
1010
- secretVault: this.secretVault
1082
+ secretVault: this.secretVault,
1083
+ commandAllowlist: this.commandAllowlist,
1084
+ daemonUrl: this.config.daemonUrl
1011
1085
  });
1012
1086
  await this.auditLogger.log({
1013
1087
  id: requestId,
@@ -1015,7 +1089,7 @@ var UnixSocketServer = class {
1015
1089
  operation: request.method,
1016
1090
  channel: "socket",
1017
1091
  allowed: true,
1018
- policyId: policyResult.policyId,
1092
+ policyId: finalPolicy.policyId,
1019
1093
  target: this.extractTarget(request),
1020
1094
  result: result.success ? "success" : "error",
1021
1095
  errorMessage: result.error?.message,
@@ -1101,10 +1175,12 @@ var HttpFallbackServer = class {
1101
1175
  config;
1102
1176
  policyEnforcer;
1103
1177
  auditLogger;
1178
+ commandAllowlist;
1104
1179
  constructor(options) {
1105
1180
  this.config = options.config;
1106
1181
  this.policyEnforcer = options.policyEnforcer;
1107
1182
  this.auditLogger = options.auditLogger;
1183
+ this.commandAllowlist = options.commandAllowlist;
1108
1184
  }
1109
1185
  /**
1110
1186
  * Start the HTTP fallback server
@@ -1225,20 +1301,29 @@ var HttpFallbackServer = class {
1225
1301
  request.params,
1226
1302
  context
1227
1303
  );
1228
- if (!policyResult.allowed) {
1304
+ let finalPolicy = policyResult;
1305
+ if (!policyResult.allowed && request.method !== "policy_check") {
1306
+ const target = this.extractTarget(request);
1307
+ const daemonUrl = this.config.daemonUrl || "http://127.0.0.1:5200";
1308
+ const override = await forwardPolicyToDaemon(request.method, target, daemonUrl);
1309
+ if (override) {
1310
+ finalPolicy = override;
1311
+ }
1312
+ }
1313
+ if (!finalPolicy.allowed) {
1229
1314
  await this.auditLogger.log({
1230
1315
  id: requestId,
1231
1316
  timestamp: /* @__PURE__ */ new Date(),
1232
1317
  operation: request.method,
1233
1318
  channel: "http",
1234
1319
  allowed: false,
1235
- policyId: policyResult.policyId,
1320
+ policyId: finalPolicy.policyId,
1236
1321
  target: this.extractTarget(request),
1237
1322
  result: "denied",
1238
- errorMessage: policyResult.reason,
1323
+ errorMessage: finalPolicy.reason,
1239
1324
  durationMs: Date.now() - startTime
1240
1325
  });
1241
- return this.errorResponse(request.id, 1001, policyResult.reason || "Policy denied");
1326
+ return this.errorResponse(request.id, 1001, finalPolicy.reason || "Policy denied");
1242
1327
  }
1243
1328
  const handler = this.getHandler(request.method);
1244
1329
  if (!handler) {
@@ -1247,8 +1332,10 @@ var HttpFallbackServer = class {
1247
1332
  const result = await handler(request.params, context, {
1248
1333
  policyEnforcer: this.policyEnforcer,
1249
1334
  auditLogger: this.auditLogger,
1250
- secretVault: null
1335
+ secretVault: null,
1251
1336
  // Not available over HTTP
1337
+ commandAllowlist: this.commandAllowlist,
1338
+ daemonUrl: this.config.daemonUrl
1252
1339
  });
1253
1340
  await this.auditLogger.log({
1254
1341
  id: requestId,
@@ -1256,7 +1343,7 @@ var HttpFallbackServer = class {
1256
1343
  operation: request.method,
1257
1344
  channel: "http",
1258
1345
  allowed: true,
1259
- policyId: policyResult.policyId,
1346
+ policyId: finalPolicy.policyId,
1260
1347
  target: this.extractTarget(request),
1261
1348
  result: result.success ? "success" : "error",
1262
1349
  errorMessage: result.error?.message,
@@ -1437,6 +1524,12 @@ var PolicyEnforcer = class {
1437
1524
  if (!constraintResult.allowed) {
1438
1525
  return constraintResult;
1439
1526
  }
1527
+ if (["file_read", "file_write", "file_list"].includes(operation) && this.policies.fsConstraints) {
1528
+ return { allowed: true, reason: "Allowed by file system constraints" };
1529
+ }
1530
+ if (operation === "http_request" && this.policies.networkConstraints) {
1531
+ return { allowed: true, reason: "Allowed by network constraints" };
1532
+ }
1440
1533
  return {
1441
1534
  allowed: this.policies.defaultAction === "allow",
1442
1535
  reason: this.policies.defaultAction === "deny" ? "No matching allow policy" : void 0
package/main.js CHANGED
@@ -251,6 +251,47 @@ function matchPattern(name, pattern) {
251
251
  // libs/shield-broker/src/handlers/exec.ts
252
252
  import * as path2 from "node:path";
253
253
  import { spawn } from "node:child_process";
254
+
255
+ // libs/shield-broker/src/daemon-forward.ts
256
+ var DAEMON_RPC_TIMEOUT = 2e3;
257
+ async function forwardPolicyToDaemon(operation, target, daemonUrl) {
258
+ try {
259
+ const controller = new AbortController();
260
+ const timeout = setTimeout(() => controller.abort(), DAEMON_RPC_TIMEOUT);
261
+ const response = await fetch(`${daemonUrl}/rpc`, {
262
+ method: "POST",
263
+ headers: { "Content-Type": "application/json" },
264
+ body: JSON.stringify({
265
+ jsonrpc: "2.0",
266
+ id: `broker-fwd-${Date.now()}`,
267
+ method: "policy_check",
268
+ params: { operation, target }
269
+ }),
270
+ signal: controller.signal
271
+ });
272
+ clearTimeout(timeout);
273
+ if (!response.ok) {
274
+ return null;
275
+ }
276
+ const json = await response.json();
277
+ if (json.error || !json.result) {
278
+ return null;
279
+ }
280
+ const result = json.result;
281
+ if (result.policyId) {
282
+ return {
283
+ allowed: !!result.allowed,
284
+ policyId: result.policyId,
285
+ reason: result.reason
286
+ };
287
+ }
288
+ return null;
289
+ } catch {
290
+ return null;
291
+ }
292
+ }
293
+
294
+ // libs/shield-broker/src/handlers/exec.ts
254
295
  var MAX_OUTPUT_SIZE = 10 * 1024 * 1024;
255
296
  var DEFAULT_WORKSPACE = "/Users/clawagent/workspace";
256
297
  var FS_COMMANDS = /* @__PURE__ */ new Set([
@@ -383,12 +424,16 @@ async function handleExec(params, context, deps) {
383
424
  if (url) {
384
425
  const networkCheck = await deps.policyEnforcer.check("http_request", { url }, context);
385
426
  if (!networkCheck.allowed) {
386
- const reason = `URL not allowed: ${url} - ${networkCheck.reason}`;
387
- deps.onExecDenied?.(command, reason);
388
- return {
389
- success: false,
390
- error: { code: 1009, message: reason }
391
- };
427
+ const daemonUrl = deps.daemonUrl || "http://127.0.0.1:5200";
428
+ const override = await forwardPolicyToDaemon("http_request", url, daemonUrl);
429
+ if (!override || !override.allowed) {
430
+ const reason = `URL not allowed: ${url} - ${networkCheck.reason}`;
431
+ deps.onExecDenied?.(command, reason);
432
+ return {
433
+ success: false,
434
+ error: { code: 1009, message: reason }
435
+ };
436
+ }
392
437
  }
393
438
  }
394
439
  }
@@ -808,6 +853,7 @@ async function handleSkillUninstall(params, context, deps) {
808
853
  }
809
854
 
810
855
  // libs/shield-broker/src/handlers/policy-check.ts
856
+ var DEFAULT_DAEMON_URL = "http://127.0.0.1:5200";
811
857
  async function handlePolicyCheck(params, context, deps) {
812
858
  const { operation, target } = params;
813
859
  if (!operation) {
@@ -838,10 +884,25 @@ async function handlePolicyCheck(params, context, deps) {
838
884
  break;
839
885
  }
840
886
  const result = await deps.policyEnforcer.check(operation, checkParams, context);
887
+ if (result.allowed) {
888
+ return {
889
+ success: true,
890
+ data: {
891
+ allowed: true,
892
+ policyId: result.policyId,
893
+ reason: result.reason
894
+ }
895
+ };
896
+ }
897
+ const daemonUrl = deps.daemonUrl || DEFAULT_DAEMON_URL;
898
+ const daemonResult = await forwardPolicyToDaemon(operation, target || "", daemonUrl);
899
+ if (daemonResult && daemonResult.allowed) {
900
+ return { success: true, data: daemonResult };
901
+ }
841
902
  return {
842
903
  success: true,
843
904
  data: {
844
- allowed: result.allowed,
905
+ allowed: false,
845
906
  policyId: result.policyId,
846
907
  reason: result.reason
847
908
  }
@@ -878,12 +939,14 @@ var UnixSocketServer = class {
878
939
  policyEnforcer;
879
940
  auditLogger;
880
941
  secretVault;
942
+ commandAllowlist;
881
943
  connections = /* @__PURE__ */ new Set();
882
944
  constructor(options) {
883
945
  this.config = options.config;
884
946
  this.policyEnforcer = options.policyEnforcer;
885
947
  this.auditLogger = options.auditLogger;
886
948
  this.secretVault = options.secretVault;
949
+ this.commandAllowlist = options.commandAllowlist;
887
950
  }
888
951
  /**
889
952
  * Start the Unix socket server
@@ -987,20 +1050,29 @@ var UnixSocketServer = class {
987
1050
  request.params,
988
1051
  context
989
1052
  );
990
- if (!policyResult.allowed) {
1053
+ let finalPolicy = policyResult;
1054
+ if (!policyResult.allowed && request.method !== "policy_check") {
1055
+ const target = this.extractTarget(request);
1056
+ const daemonUrl = this.config.daemonUrl || "http://127.0.0.1:5200";
1057
+ const override = await forwardPolicyToDaemon(request.method, target, daemonUrl);
1058
+ if (override) {
1059
+ finalPolicy = override;
1060
+ }
1061
+ }
1062
+ if (!finalPolicy.allowed) {
991
1063
  await this.auditLogger.log({
992
1064
  id: requestId,
993
1065
  timestamp: /* @__PURE__ */ new Date(),
994
1066
  operation: request.method,
995
1067
  channel: "socket",
996
1068
  allowed: false,
997
- policyId: policyResult.policyId,
1069
+ policyId: finalPolicy.policyId,
998
1070
  target: this.extractTarget(request),
999
1071
  result: "denied",
1000
- errorMessage: policyResult.reason,
1072
+ errorMessage: finalPolicy.reason,
1001
1073
  durationMs: Date.now() - startTime
1002
1074
  });
1003
- return this.errorResponse(request.id, 1001, policyResult.reason || "Policy denied");
1075
+ return this.errorResponse(request.id, 1001, finalPolicy.reason || "Policy denied");
1004
1076
  }
1005
1077
  const handler = this.getHandler(request.method);
1006
1078
  if (!handler) {
@@ -1009,7 +1081,9 @@ var UnixSocketServer = class {
1009
1081
  const result = await handler(request.params, context, {
1010
1082
  policyEnforcer: this.policyEnforcer,
1011
1083
  auditLogger: this.auditLogger,
1012
- secretVault: this.secretVault
1084
+ secretVault: this.secretVault,
1085
+ commandAllowlist: this.commandAllowlist,
1086
+ daemonUrl: this.config.daemonUrl
1013
1087
  });
1014
1088
  await this.auditLogger.log({
1015
1089
  id: requestId,
@@ -1017,7 +1091,7 @@ var UnixSocketServer = class {
1017
1091
  operation: request.method,
1018
1092
  channel: "socket",
1019
1093
  allowed: true,
1020
- policyId: policyResult.policyId,
1094
+ policyId: finalPolicy.policyId,
1021
1095
  target: this.extractTarget(request),
1022
1096
  result: result.success ? "success" : "error",
1023
1097
  errorMessage: result.error?.message,
@@ -1103,10 +1177,12 @@ var HttpFallbackServer = class {
1103
1177
  config;
1104
1178
  policyEnforcer;
1105
1179
  auditLogger;
1180
+ commandAllowlist;
1106
1181
  constructor(options) {
1107
1182
  this.config = options.config;
1108
1183
  this.policyEnforcer = options.policyEnforcer;
1109
1184
  this.auditLogger = options.auditLogger;
1185
+ this.commandAllowlist = options.commandAllowlist;
1110
1186
  }
1111
1187
  /**
1112
1188
  * Start the HTTP fallback server
@@ -1227,20 +1303,29 @@ var HttpFallbackServer = class {
1227
1303
  request.params,
1228
1304
  context
1229
1305
  );
1230
- if (!policyResult.allowed) {
1306
+ let finalPolicy = policyResult;
1307
+ if (!policyResult.allowed && request.method !== "policy_check") {
1308
+ const target = this.extractTarget(request);
1309
+ const daemonUrl = this.config.daemonUrl || "http://127.0.0.1:5200";
1310
+ const override = await forwardPolicyToDaemon(request.method, target, daemonUrl);
1311
+ if (override) {
1312
+ finalPolicy = override;
1313
+ }
1314
+ }
1315
+ if (!finalPolicy.allowed) {
1231
1316
  await this.auditLogger.log({
1232
1317
  id: requestId,
1233
1318
  timestamp: /* @__PURE__ */ new Date(),
1234
1319
  operation: request.method,
1235
1320
  channel: "http",
1236
1321
  allowed: false,
1237
- policyId: policyResult.policyId,
1322
+ policyId: finalPolicy.policyId,
1238
1323
  target: this.extractTarget(request),
1239
1324
  result: "denied",
1240
- errorMessage: policyResult.reason,
1325
+ errorMessage: finalPolicy.reason,
1241
1326
  durationMs: Date.now() - startTime
1242
1327
  });
1243
- return this.errorResponse(request.id, 1001, policyResult.reason || "Policy denied");
1328
+ return this.errorResponse(request.id, 1001, finalPolicy.reason || "Policy denied");
1244
1329
  }
1245
1330
  const handler = this.getHandler(request.method);
1246
1331
  if (!handler) {
@@ -1249,8 +1334,10 @@ var HttpFallbackServer = class {
1249
1334
  const result = await handler(request.params, context, {
1250
1335
  policyEnforcer: this.policyEnforcer,
1251
1336
  auditLogger: this.auditLogger,
1252
- secretVault: null
1337
+ secretVault: null,
1253
1338
  // Not available over HTTP
1339
+ commandAllowlist: this.commandAllowlist,
1340
+ daemonUrl: this.config.daemonUrl
1254
1341
  });
1255
1342
  await this.auditLogger.log({
1256
1343
  id: requestId,
@@ -1258,7 +1345,7 @@ var HttpFallbackServer = class {
1258
1345
  operation: request.method,
1259
1346
  channel: "http",
1260
1347
  allowed: true,
1261
- policyId: policyResult.policyId,
1348
+ policyId: finalPolicy.policyId,
1262
1349
  target: this.extractTarget(request),
1263
1350
  result: result.success ? "success" : "error",
1264
1351
  errorMessage: result.error?.message,
@@ -1439,6 +1526,12 @@ var PolicyEnforcer = class {
1439
1526
  if (!constraintResult.allowed) {
1440
1527
  return constraintResult;
1441
1528
  }
1529
+ if (["file_read", "file_write", "file_list"].includes(operation) && this.policies.fsConstraints) {
1530
+ return { allowed: true, reason: "Allowed by file system constraints" };
1531
+ }
1532
+ if (operation === "http_request" && this.policies.networkConstraints) {
1533
+ return { allowed: true, reason: "Allowed by network constraints" };
1534
+ }
1442
1535
  return {
1443
1536
  allowed: this.policies.defaultAction === "allow",
1444
1537
  reason: this.policies.defaultAction === "deny" ? "No matching allow policy" : void 0
@@ -1858,9 +1951,190 @@ function getDefaultPolicies(options) {
1858
1951
  };
1859
1952
  }
1860
1953
 
1861
- // libs/shield-broker/src/audit/logger.ts
1954
+ // libs/shield-broker/src/policies/command-allowlist.ts
1862
1955
  import * as fs5 from "node:fs";
1863
1956
  import * as path5 from "node:path";
1957
+ var BUILTIN_COMMANDS = {
1958
+ git: ["/usr/bin/git", "/opt/homebrew/bin/git", "/usr/local/bin/git"],
1959
+ ssh: ["/usr/bin/ssh"],
1960
+ scp: ["/usr/bin/scp"],
1961
+ rsync: ["/usr/bin/rsync", "/opt/homebrew/bin/rsync"],
1962
+ brew: ["/opt/homebrew/bin/brew", "/usr/local/bin/brew"],
1963
+ npm: ["/opt/homebrew/bin/npm", "/usr/local/bin/npm"],
1964
+ npx: ["/opt/homebrew/bin/npx", "/usr/local/bin/npx"],
1965
+ pip: ["/usr/bin/pip", "/usr/local/bin/pip", "/opt/homebrew/bin/pip"],
1966
+ pip3: ["/usr/bin/pip3", "/usr/local/bin/pip3", "/opt/homebrew/bin/pip3"],
1967
+ node: ["/opt/homebrew/bin/node", "/usr/local/bin/node"],
1968
+ python: ["/usr/bin/python", "/usr/local/bin/python", "/opt/homebrew/bin/python"],
1969
+ python3: ["/usr/bin/python3", "/usr/local/bin/python3", "/opt/homebrew/bin/python3"],
1970
+ ls: ["/bin/ls"],
1971
+ cat: ["/bin/cat"],
1972
+ grep: ["/usr/bin/grep"],
1973
+ find: ["/usr/bin/find"],
1974
+ mkdir: ["/bin/mkdir"],
1975
+ cp: ["/bin/cp"],
1976
+ mv: ["/bin/mv"],
1977
+ rm: ["/bin/rm"],
1978
+ touch: ["/usr/bin/touch"],
1979
+ chmod: ["/bin/chmod"],
1980
+ head: ["/usr/bin/head"],
1981
+ tail: ["/usr/bin/tail"],
1982
+ wc: ["/usr/bin/wc"],
1983
+ sort: ["/usr/bin/sort"],
1984
+ uniq: ["/usr/bin/uniq"],
1985
+ sed: ["/usr/bin/sed"],
1986
+ awk: ["/usr/bin/awk"],
1987
+ tar: ["/usr/bin/tar"],
1988
+ curl: ["/usr/bin/curl"],
1989
+ wget: ["/usr/local/bin/wget", "/opt/homebrew/bin/wget"]
1990
+ };
1991
+ var CommandAllowlist = class {
1992
+ configPath;
1993
+ dynamicCommands = /* @__PURE__ */ new Map();
1994
+ lastLoad = 0;
1995
+ reloadInterval = 3e4;
1996
+ // 30 seconds
1997
+ constructor(configPath) {
1998
+ this.configPath = configPath;
1999
+ this.load();
2000
+ }
2001
+ /**
2002
+ * Load dynamic commands from disk
2003
+ */
2004
+ load() {
2005
+ if (!fs5.existsSync(this.configPath)) {
2006
+ this.lastLoad = Date.now();
2007
+ return;
2008
+ }
2009
+ try {
2010
+ const content = fs5.readFileSync(this.configPath, "utf-8");
2011
+ const config = JSON.parse(content);
2012
+ this.dynamicCommands.clear();
2013
+ for (const cmd of config.commands || []) {
2014
+ this.dynamicCommands.set(cmd.name, cmd);
2015
+ }
2016
+ this.lastLoad = Date.now();
2017
+ } catch {
2018
+ this.lastLoad = Date.now();
2019
+ }
2020
+ }
2021
+ /**
2022
+ * Reload dynamic commands if stale
2023
+ */
2024
+ maybeReload() {
2025
+ if (Date.now() - this.lastLoad > this.reloadInterval) {
2026
+ this.load();
2027
+ }
2028
+ }
2029
+ /**
2030
+ * Persist dynamic commands to disk
2031
+ */
2032
+ save() {
2033
+ const dir = path5.dirname(this.configPath);
2034
+ if (!fs5.existsSync(dir)) {
2035
+ fs5.mkdirSync(dir, { recursive: true });
2036
+ }
2037
+ const config = {
2038
+ version: "1.0.0",
2039
+ commands: Array.from(this.dynamicCommands.values())
2040
+ };
2041
+ fs5.writeFileSync(this.configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
2042
+ }
2043
+ /**
2044
+ * Add a dynamic command
2045
+ */
2046
+ add(cmd) {
2047
+ this.dynamicCommands.set(cmd.name, cmd);
2048
+ this.save();
2049
+ }
2050
+ /**
2051
+ * Remove a dynamic command
2052
+ */
2053
+ remove(name) {
2054
+ const existed = this.dynamicCommands.delete(name);
2055
+ if (existed) {
2056
+ this.save();
2057
+ }
2058
+ return existed;
2059
+ }
2060
+ /**
2061
+ * Get a dynamic command by name
2062
+ */
2063
+ get(name) {
2064
+ return this.dynamicCommands.get(name);
2065
+ }
2066
+ /**
2067
+ * List all commands (builtin + dynamic)
2068
+ */
2069
+ list() {
2070
+ const result = [];
2071
+ for (const [name, paths] of Object.entries(BUILTIN_COMMANDS)) {
2072
+ result.push({
2073
+ name,
2074
+ paths,
2075
+ addedAt: "",
2076
+ addedBy: "builtin",
2077
+ builtin: true
2078
+ });
2079
+ }
2080
+ for (const cmd of this.dynamicCommands.values()) {
2081
+ result.push({ ...cmd, builtin: false });
2082
+ }
2083
+ return result;
2084
+ }
2085
+ /**
2086
+ * List only dynamic commands
2087
+ */
2088
+ listDynamic() {
2089
+ return Array.from(this.dynamicCommands.values());
2090
+ }
2091
+ /**
2092
+ * Check if a command name conflicts with a builtin
2093
+ */
2094
+ isBuiltin(name) {
2095
+ return name in BUILTIN_COMMANDS;
2096
+ }
2097
+ /**
2098
+ * Resolve a command name to an absolute path.
2099
+ * Checks builtin commands first, then dynamic commands.
2100
+ * Validates that the resolved path exists on disk.
2101
+ * Returns null if the command is not allowed.
2102
+ */
2103
+ resolve(command) {
2104
+ this.maybeReload();
2105
+ if (path5.isAbsolute(command)) {
2106
+ for (const paths of Object.values(BUILTIN_COMMANDS)) {
2107
+ if (paths.includes(command) && fs5.existsSync(command)) {
2108
+ return command;
2109
+ }
2110
+ }
2111
+ for (const cmd of this.dynamicCommands.values()) {
2112
+ if (cmd.paths.includes(command) && fs5.existsSync(command)) {
2113
+ return command;
2114
+ }
2115
+ }
2116
+ return null;
2117
+ }
2118
+ const basename3 = path5.basename(command);
2119
+ const builtinPaths = BUILTIN_COMMANDS[basename3];
2120
+ if (builtinPaths) {
2121
+ for (const p of builtinPaths) {
2122
+ if (fs5.existsSync(p)) return p;
2123
+ }
2124
+ }
2125
+ const dynamicCmd = this.dynamicCommands.get(basename3);
2126
+ if (dynamicCmd && dynamicCmd.paths.length > 0) {
2127
+ for (const p of dynamicCmd.paths) {
2128
+ if (fs5.existsSync(p)) return p;
2129
+ }
2130
+ }
2131
+ return null;
2132
+ }
2133
+ };
2134
+
2135
+ // libs/shield-broker/src/audit/logger.ts
2136
+ import * as fs6 from "node:fs";
2137
+ import * as path6 from "node:path";
1864
2138
  var AuditLogger = class {
1865
2139
  logPath;
1866
2140
  logLevel;
@@ -1885,15 +2159,15 @@ var AuditLogger = class {
1885
2159
  * Initialize the write stream
1886
2160
  */
1887
2161
  initializeStream() {
1888
- const dir = path5.dirname(this.logPath);
1889
- if (!fs5.existsSync(dir)) {
1890
- fs5.mkdirSync(dir, { recursive: true });
2162
+ const dir = path6.dirname(this.logPath);
2163
+ if (!fs6.existsSync(dir)) {
2164
+ fs6.mkdirSync(dir, { recursive: true });
1891
2165
  }
1892
- if (fs5.existsSync(this.logPath)) {
1893
- const stats = fs5.statSync(this.logPath);
2166
+ if (fs6.existsSync(this.logPath)) {
2167
+ const stats = fs6.statSync(this.logPath);
1894
2168
  this.currentSize = stats.size;
1895
2169
  }
1896
- this.writeStream = fs5.createWriteStream(this.logPath, {
2170
+ this.writeStream = fs6.createWriteStream(this.logPath, {
1897
2171
  flags: "a",
1898
2172
  encoding: "utf-8"
1899
2173
  });
@@ -1912,16 +2186,16 @@ var AuditLogger = class {
1912
2186
  for (let i = this.maxFiles - 1; i >= 1; i--) {
1913
2187
  const oldPath = `${this.logPath}.${i}`;
1914
2188
  const newPath = `${this.logPath}.${i + 1}`;
1915
- if (fs5.existsSync(oldPath)) {
2189
+ if (fs6.existsSync(oldPath)) {
1916
2190
  if (i === this.maxFiles - 1) {
1917
- fs5.unlinkSync(oldPath);
2191
+ fs6.unlinkSync(oldPath);
1918
2192
  } else {
1919
- fs5.renameSync(oldPath, newPath);
2193
+ fs6.renameSync(oldPath, newPath);
1920
2194
  }
1921
2195
  }
1922
2196
  }
1923
- if (fs5.existsSync(this.logPath)) {
1924
- fs5.renameSync(this.logPath, `${this.logPath}.1`);
2197
+ if (fs6.existsSync(this.logPath)) {
2198
+ fs6.renameSync(this.logPath, `${this.logPath}.1`);
1925
2199
  }
1926
2200
  this.currentSize = 0;
1927
2201
  this.initializeStream();
@@ -1994,10 +2268,10 @@ var AuditLogger = class {
1994
2268
  async query(options) {
1995
2269
  const results = [];
1996
2270
  const limit = options.limit || 1e3;
1997
- if (!fs5.existsSync(this.logPath)) {
2271
+ if (!fs6.existsSync(this.logPath)) {
1998
2272
  return results;
1999
2273
  }
2000
- const content = fs5.readFileSync(this.logPath, "utf-8");
2274
+ const content = fs6.readFileSync(this.logPath, "utf-8");
2001
2275
  const lines = content.trim().split("\n");
2002
2276
  for (const line of lines.reverse()) {
2003
2277
  if (results.length >= limit) break;
@@ -2035,7 +2309,7 @@ var AuditLogger = class {
2035
2309
  };
2036
2310
 
2037
2311
  // libs/shield-broker/src/secrets/vault.ts
2038
- import * as fs6 from "node:fs/promises";
2312
+ import * as fs7 from "node:fs/promises";
2039
2313
  import * as crypto from "node:crypto";
2040
2314
  var SecretVault = class {
2041
2315
  vaultPath;
@@ -2057,11 +2331,11 @@ var SecretVault = class {
2057
2331
  async loadOrCreateKey() {
2058
2332
  const keyPath = this.vaultPath.replace(".enc", ".key");
2059
2333
  try {
2060
- const keyData = await fs6.readFile(keyPath);
2334
+ const keyData = await fs7.readFile(keyPath);
2061
2335
  return keyData;
2062
2336
  } catch {
2063
2337
  const key = crypto.randomBytes(32);
2064
- await fs6.writeFile(keyPath, key, { mode: 384 });
2338
+ await fs7.writeFile(keyPath, key, { mode: 384 });
2065
2339
  return key;
2066
2340
  }
2067
2341
  }
@@ -2070,7 +2344,7 @@ var SecretVault = class {
2070
2344
  */
2071
2345
  async load() {
2072
2346
  try {
2073
- const content = await fs6.readFile(this.vaultPath, "utf-8");
2347
+ const content = await fs7.readFile(this.vaultPath, "utf-8");
2074
2348
  this.data = JSON.parse(content);
2075
2349
  } catch {
2076
2350
  this.data = {
@@ -2084,7 +2358,7 @@ var SecretVault = class {
2084
2358
  */
2085
2359
  async save() {
2086
2360
  if (!this.data) return;
2087
- await fs6.writeFile(
2361
+ await fs7.writeFile(
2088
2362
  this.vaultPath,
2089
2363
  JSON.stringify(this.data, null, 2),
2090
2364
  { mode: 384 }
@@ -2202,14 +2476,30 @@ var SecretVault = class {
2202
2476
  };
2203
2477
 
2204
2478
  // libs/shield-broker/src/main.ts
2205
- import * as fs7 from "node:fs";
2206
- import * as path6 from "node:path";
2479
+ import * as fs8 from "node:fs";
2480
+ import * as path7 from "node:path";
2481
+ var PROXIED_COMMANDS = [
2482
+ "curl",
2483
+ "wget",
2484
+ "git",
2485
+ "ssh",
2486
+ "scp",
2487
+ "rsync",
2488
+ "brew",
2489
+ "npm",
2490
+ "npx",
2491
+ "pip",
2492
+ "pip3",
2493
+ "open-url",
2494
+ "shieldctl",
2495
+ "agenco"
2496
+ ];
2207
2497
  function loadConfig() {
2208
2498
  const configPath = process.env["AGENSHIELD_CONFIG"] || "/opt/agenshield/config/shield.json";
2209
2499
  let fileConfig = {};
2210
- if (fs7.existsSync(configPath)) {
2500
+ if (fs8.existsSync(configPath)) {
2211
2501
  try {
2212
- const content = fs7.readFileSync(configPath, "utf-8");
2502
+ const content = fs8.readFileSync(configPath, "utf-8");
2213
2503
  fileConfig = JSON.parse(content);
2214
2504
  } catch (error) {
2215
2505
  console.warn(`Warning: Failed to load config from ${configPath}:`, error);
@@ -2231,16 +2521,17 @@ function loadConfig() {
2231
2521
  socketMode: fileConfig.socketMode || 438,
2232
2522
  socketOwner: fileConfig.socketOwner || "clawbroker",
2233
2523
  socketGroup: fileConfig.socketGroup || "clawshield",
2234
- agentHome: process.env["AGENSHIELD_AGENT_HOME"] || fileConfig.agentHome
2524
+ agentHome: process.env["AGENSHIELD_AGENT_HOME"] || fileConfig.agentHome,
2525
+ daemonUrl: process.env["AGENSHIELD_DAEMON_URL"] || fileConfig.daemonUrl || "http://127.0.0.1:5200"
2235
2526
  };
2236
2527
  }
2237
2528
  function ensureDirectories(config) {
2238
- const socketDir = path6.dirname(config.socketPath);
2239
- const auditDir = path6.dirname(config.auditLogPath);
2529
+ const socketDir = path7.dirname(config.socketPath);
2530
+ const auditDir = path7.dirname(config.auditLogPath);
2240
2531
  for (const dir of [socketDir, auditDir, config.policiesPath]) {
2241
- if (!fs7.existsSync(dir)) {
2532
+ if (!fs8.existsSync(dir)) {
2242
2533
  try {
2243
- fs7.mkdirSync(dir, { recursive: true, mode: 493 });
2534
+ fs8.mkdirSync(dir, { recursive: true, mode: 493 });
2244
2535
  } catch (error) {
2245
2536
  if (error.code !== "EEXIST") {
2246
2537
  console.warn(`Warning: Could not create directory ${dir}:`, error);
@@ -2249,6 +2540,47 @@ function ensureDirectories(config) {
2249
2540
  }
2250
2541
  }
2251
2542
  }
2543
+ function ensureProxiedCommandWrappers(binDir) {
2544
+ if (!fs8.existsSync(binDir)) {
2545
+ try {
2546
+ fs8.mkdirSync(binDir, { recursive: true, mode: 493 });
2547
+ } catch {
2548
+ console.warn(`[broker] cannot create bin dir ${binDir}`);
2549
+ return;
2550
+ }
2551
+ }
2552
+ const shieldExecPath = "/opt/agenshield/bin/shield-exec";
2553
+ const hasShieldExec = fs8.existsSync(shieldExecPath);
2554
+ let installed = 0;
2555
+ for (const cmd of PROXIED_COMMANDS) {
2556
+ const wrapperPath = path7.join(binDir, cmd);
2557
+ if (fs8.existsSync(wrapperPath)) continue;
2558
+ if (hasShieldExec) {
2559
+ try {
2560
+ fs8.symlinkSync(shieldExecPath, wrapperPath);
2561
+ installed++;
2562
+ continue;
2563
+ } catch {
2564
+ }
2565
+ }
2566
+ try {
2567
+ const script = [
2568
+ "#!/bin/bash",
2569
+ `# ${cmd} - AgenShield proxy (auto-generated)`,
2570
+ "if ! /bin/pwd > /dev/null 2>&1; then cd ~ 2>/dev/null || cd /; fi",
2571
+ `exec /opt/agenshield/bin/shield-client exec ${cmd} "$@"`,
2572
+ ""
2573
+ ].join("\n");
2574
+ fs8.writeFileSync(wrapperPath, script, { mode: 493 });
2575
+ installed++;
2576
+ } catch {
2577
+ console.warn(`[broker] cannot write wrapper for ${cmd}`);
2578
+ }
2579
+ }
2580
+ if (installed > 0) {
2581
+ console.log(`[broker] installed ${installed} command wrappers in ${binDir}`);
2582
+ }
2583
+ }
2252
2584
  async function main() {
2253
2585
  console.log(`AgenShield Broker starting at ${(/* @__PURE__ */ new Date()).toISOString()}`);
2254
2586
  console.log(`PID: ${process.pid}, UID: ${process.getuid?.()}, GID: ${process.getgid?.()}`);
@@ -2267,6 +2599,7 @@ async function main() {
2267
2599
  console.log(`HTTP Fallback: ${config.httpEnabled ? `${config.httpHost}:${config.httpPort}` : "disabled"}`);
2268
2600
  console.log(`Policies: ${config.policiesPath}`);
2269
2601
  console.log(`Agent Home: ${config.agentHome || "(env fallback)"}`);
2602
+ console.log(`Daemon URL: ${config.daemonUrl || "(default)"}`);
2270
2603
  console.log(`Log Level: ${config.logLevel}`);
2271
2604
  try {
2272
2605
  ensureDirectories(config);
@@ -2286,11 +2619,18 @@ async function main() {
2286
2619
  const secretVault = new SecretVault({
2287
2620
  vaultPath: "/etc/agenshield/vault.enc"
2288
2621
  });
2622
+ const commandAllowlist = new CommandAllowlist(
2623
+ "/opt/agenshield/config/allowed-commands.json"
2624
+ );
2625
+ if (config.agentHome) {
2626
+ ensureProxiedCommandWrappers(path7.join(config.agentHome, "bin"));
2627
+ }
2289
2628
  const socketServer = new UnixSocketServer({
2290
2629
  config,
2291
2630
  policyEnforcer,
2292
2631
  auditLogger,
2293
- secretVault
2632
+ secretVault,
2633
+ commandAllowlist
2294
2634
  });
2295
2635
  await socketServer.start();
2296
2636
  console.log(`Unix socket server listening on ${config.socketPath}`);
@@ -2299,7 +2639,8 @@ async function main() {
2299
2639
  httpServer = new HttpFallbackServer({
2300
2640
  config,
2301
2641
  policyEnforcer,
2302
- auditLogger
2642
+ auditLogger,
2643
+ commandAllowlist
2303
2644
  });
2304
2645
  await httpServer.start();
2305
2646
  console.log(`HTTP fallback server listening on ${config.httpHost}:${config.httpPort}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenshield/broker",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "description": "AgenShield broker daemon with Unix socket and HTTP fallback",
6
6
  "main": "./index.js",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "@agenshield/ipc": "0.6.0"
27
+ "@agenshield/ipc": "0.6.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^24.0.0",
@@ -17,11 +17,17 @@ export interface AllowedCommand {
17
17
  export declare class CommandAllowlist {
18
18
  private configPath;
19
19
  private dynamicCommands;
20
+ private lastLoad;
21
+ private reloadInterval;
20
22
  constructor(configPath: string);
21
23
  /**
22
24
  * Load dynamic commands from disk
23
25
  */
24
26
  load(): void;
27
+ /**
28
+ * Reload dynamic commands if stale
29
+ */
30
+ private maybeReload;
25
31
  /**
26
32
  * Persist dynamic commands to disk
27
33
  */
@@ -55,6 +61,7 @@ export declare class CommandAllowlist {
55
61
  /**
56
62
  * Resolve a command name to an absolute path.
57
63
  * Checks builtin commands first, then dynamic commands.
64
+ * Validates that the resolved path exists on disk.
58
65
  * Returns null if the command is not allowed.
59
66
  */
60
67
  resolve(command: string): string | null;
@@ -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;AAiDD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAA0C;gBAErD,UAAU,EAAE,MAAM;IAK9B;;OAEG;IACH,IAAI,IAAI,IAAI;IAkBZ;;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;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAmCxC"}
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,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 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 { CommandAllowlist } from './policies/command-allowlist.js';
11
12
  export interface UnixSocketServerOptions {
12
13
  config: BrokerConfig;
13
14
  policyEnforcer: PolicyEnforcer;
14
15
  auditLogger: AuditLogger;
15
16
  secretVault: SecretVault;
17
+ commandAllowlist: CommandAllowlist;
16
18
  }
17
19
  export declare class UnixSocketServer {
18
20
  private server;
@@ -20,6 +22,7 @@ export declare class UnixSocketServer {
20
22
  private policyEnforcer;
21
23
  private auditLogger;
22
24
  private secretVault;
25
+ private commandAllowlist;
23
26
  private connections;
24
27
  constructor(options: UnixSocketServerOptions);
25
28
  /**
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;AAGtD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;CAC1B;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,WAAW,CAA8B;gBAErC,OAAO,EAAE,uBAAuB;IAO5C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C;IA0B3B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA+BxB;;OAEG;YACW,cAAc;IAkH5B;;OAEG;IACH,OAAO,CAAC,UAAU;IA2BlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAWrB;;OAEG;IACH,OAAO,CAAC,aAAa;CAWtB"}
package/types.d.ts CHANGED
@@ -32,6 +32,8 @@ export interface BrokerConfig {
32
32
  socketGroup?: string;
33
33
  /** Agent home directory (for fs policy paths) */
34
34
  agentHome?: string;
35
+ /** Daemon RPC URL for policy forwarding (default: http://127.0.0.1:5200) */
36
+ daemonUrl?: string;
35
37
  }
36
38
  /**
37
39
  * Context passed to operation handlers
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;IAC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