claude-warden 1.1.11 → 1.2.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-warden",
3
- "version": "1.1.11",
3
+ "version": "1.2.1",
4
4
  "description": "Smart command safety filter for Claude Code — parses shell pipelines and evaluates per-command safety rules to auto-approve safe commands and block dangerous ones",
5
5
  "author": {
6
6
  "name": "banyudu"
@@ -51,6 +51,17 @@ askOnSubshell: true
51
51
  # - my-sprite
52
52
  # - dev-*
53
53
 
54
+ # Override rules when evaluating commands inside trusted remote contexts
55
+ # (docker exec, kubectl exec, ssh, sprite exec). These overrides are applied
56
+ # as the highest-priority layer only for remote command evaluation.
57
+ # trustedContextOverrides:
58
+ # alwaysAllow:
59
+ # - sudo
60
+ # - apt
61
+ # - apt-get
62
+ # alwaysDeny: []
63
+ # rules: []
64
+
54
65
  # Command-specific rules (override built-in rules by command name).
55
66
  # The first scope (project > user > default) with a rule for a given command wins.
56
67
  # rules:
package/dist/index.cjs CHANGED
@@ -18583,7 +18583,7 @@ function evaluateSSHCommand(cmd, config) {
18583
18583
  };
18584
18584
  }
18585
18585
  const parsed = parseCommand(remoteCommand);
18586
- const result = evaluate(parsed, config);
18586
+ const result = evaluate(parsed, configWithContextOverrides(config));
18587
18587
  return {
18588
18588
  command,
18589
18589
  args: args2,
@@ -18603,7 +18603,15 @@ var DOCKER_EXEC_FLAGS_WITH_VALUE = /* @__PURE__ */ new Set([
18603
18603
  "--detach-keys"
18604
18604
  ]);
18605
18605
  var INTERACTIVE_SHELLS = /* @__PURE__ */ new Set(["bash", "sh", "zsh"]);
18606
+ function configWithContextOverrides(config) {
18607
+ if (!config.trustedContextOverrides) return config;
18608
+ return {
18609
+ ...config,
18610
+ layers: [config.trustedContextOverrides, ...config.layers]
18611
+ };
18612
+ }
18606
18613
  function evaluateRemoteCommand(remoteArgs, config) {
18614
+ const overriddenConfig = configWithContextOverrides(config);
18607
18615
  if (remoteArgs.length === 0) {
18608
18616
  return { decision: "allow", reason: "interactive", details: [] };
18609
18617
  }
@@ -18614,14 +18622,14 @@ function evaluateRemoteCommand(remoteArgs, config) {
18614
18622
  if (INTERACTIVE_SHELLS.has(remoteCmd) && remoteArgs[1] === "-c" && remoteArgs.length >= 3) {
18615
18623
  const innerCommand = remoteArgs.slice(2).join(" ");
18616
18624
  const parsed2 = parseCommand(innerCommand);
18617
- return evaluate(parsed2, config);
18625
+ return evaluate(parsed2, overriddenConfig);
18618
18626
  }
18619
18627
  const parsed = {
18620
18628
  commands: [{ command: remoteCmd, args: remoteArgs.slice(1) }],
18621
18629
  hasSubshell: false,
18622
18630
  subshellCommands: []
18623
18631
  };
18624
- return evaluate(parsed, config);
18632
+ return evaluate(parsed, overriddenConfig);
18625
18633
  }
18626
18634
  function parseDockerExecArgs(args2) {
18627
18635
  let target = null;
@@ -18896,7 +18904,8 @@ var SAFE_PKG_MANAGER_CMDS = [
18896
18904
  "dedupe",
18897
18905
  "prune",
18898
18906
  "audit",
18899
- "completion"
18907
+ "completion",
18908
+ "whoami"
18900
18909
  ];
18901
18910
  var VERSION_HELP_FLAGS = {
18902
18911
  match: { anyArgMatches: ["^--(version|help)$", "^-[vh]$"] },
@@ -19345,6 +19354,19 @@ function mergeNonLayerFields(config, raw) {
19345
19354
  if (typeof raw.askOnSubshell === "boolean") {
19346
19355
  config.askOnSubshell = raw.askOnSubshell;
19347
19356
  }
19357
+ if (raw.trustedContextOverrides && typeof raw.trustedContextOverrides === "object") {
19358
+ const overrides = raw.trustedContextOverrides;
19359
+ const layer = extractLayer(overrides);
19360
+ if (config.trustedContextOverrides) {
19361
+ config.trustedContextOverrides = {
19362
+ alwaysAllow: [...layer.alwaysAllow, ...config.trustedContextOverrides.alwaysAllow],
19363
+ alwaysDeny: [...layer.alwaysDeny, ...config.trustedContextOverrides.alwaysDeny],
19364
+ rules: [...layer.rules, ...config.trustedContextOverrides.rules]
19365
+ };
19366
+ } else {
19367
+ config.trustedContextOverrides = layer;
19368
+ }
19369
+ }
19348
19370
  }
19349
19371
 
19350
19372
  // src/suggest.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-warden",
3
- "version": "1.1.11",
3
+ "version": "1.2.1",
4
4
  "description": "Smart command safety filter for Claude Code — auto-approves safe commands, blocks dangerous ones",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",