@kenhkl/agent-moss 0.17.35 → 0.17.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3310,7 +3310,7 @@ function _dedup(rules, category) {
3310
3310
  const seen = /* @__PURE__ */ new Set();
3311
3311
  const out = [];
3312
3312
  for (const r of rules) {
3313
- const k = keys.map((x) => String(r?.[x] ?? "")).join("\0");
3313
+ const k = keys.map((x) => x === "os" ? String(r?.os || "linux") : String(r?.[x] ?? "")).join("\0");
3314
3314
  if (seen.has(k)) continue;
3315
3315
  seen.add(k);
3316
3316
  out.push(r);
@@ -4530,7 +4530,11 @@ var init_runtime_config = __esm({
4530
4530
  dangerous_commands: ["pattern"],
4531
4531
  password_modify_consent: ["pattern"],
4532
4532
  user_deletion_consent: ["pattern"],
4533
- sensitive_path_access: ["path"],
4533
+ // ⚠️ 必须含 os:跨平台同名 path(.ssh / .aws / .agentmoss)各有独立条目。
4534
+ // 去重发生在 _filterRulesByOs 之前,若键只有 path,linux 条目(种子中先出现)
4535
+ // 会把 windows 同名条目顶掉 → Windows 真实运行时的目录级删除拦截静默失效
4536
+ // (2026-11 修;与 Python `_DEDUP_KEYS` 同步)。
4537
+ sensitive_path_access: ["path", "os"],
4534
4538
  injection_detection: ["keyword", "lang"],
4535
4539
  intent_consistency: ["intent_keywords", "reason"]
4536
4540
  };
@@ -14377,6 +14381,14 @@ async function analyzeRoute(c) {
14377
14381
  try {
14378
14382
  const body = await c.req.json();
14379
14383
  const req = AnalyzeRequestSchema.parse(normalizeObservablePayload(body));
14384
+ const unmappedTool = String(
14385
+ req.metadata?.unmapped_tool || ""
14386
+ );
14387
+ if (unmappedTool) {
14388
+ degradedNotes.push(
14389
+ `\u3010\u5DF2\u964D\u7EA7\u3011\u5DE5\u5177\u540D '${unmappedTool}' \u672A\u8BC6\u522B\u4E3A\u6807\u51C6\u52A8\u4F5C\u7C7B\u578B\uFF1A\u4F9D\u8D56\u52A8\u4F5C\u7C7B\u578B\u7684 L2 \u89C4\u5219\uFF08\u8BFB\u540E\u5199 / \u7EC4\u5408\u94FE / \u6388\u6743\uFF09\u53EF\u80FD\u672A\u751F\u6548\uFF1BL1\uFF08\u547D\u4EE4\u5185\u5BB9\uFF09\u4E0E L3 \u6B63\u5E38\u3002\u53EF\u5728 AgentGate \u914D\u7F6E AGENT_GATE_TOOL_NAME_MAP \u8865\u5145\u6620\u5C04\uFF08\u5982 {"${unmappedTool}": "read"}\uFF09\u3002`
14390
+ );
14391
+ }
14380
14392
  let osType = req.os_type;
14381
14393
  if (!osType) {
14382
14394
  osType = process.platform === "win32" ? "windows" : "linux";
@@ -2431,7 +2431,7 @@ function _dedup(rules, category) {
2431
2431
  const seen = /* @__PURE__ */ new Set();
2432
2432
  const out = [];
2433
2433
  for (const r of rules) {
2434
- const k = keys.map((x) => String(r?.[x] ?? "")).join("\0");
2434
+ const k = keys.map((x) => x === "os" ? String(r?.os || "linux") : String(r?.[x] ?? "")).join("\0");
2435
2435
  if (seen.has(k)) continue;
2436
2436
  seen.add(k);
2437
2437
  out.push(r);
@@ -3651,7 +3651,11 @@ var init_runtime_config = __esm({
3651
3651
  dangerous_commands: ["pattern"],
3652
3652
  password_modify_consent: ["pattern"],
3653
3653
  user_deletion_consent: ["pattern"],
3654
- sensitive_path_access: ["path"],
3654
+ // ⚠️ 必须含 os:跨平台同名 path(.ssh / .aws / .agentmoss)各有独立条目。
3655
+ // 去重发生在 _filterRulesByOs 之前,若键只有 path,linux 条目(种子中先出现)
3656
+ // 会把 windows 同名条目顶掉 → Windows 真实运行时的目录级删除拦截静默失效
3657
+ // (2026-11 修;与 Python `_DEDUP_KEYS` 同步)。
3658
+ sensitive_path_access: ["path", "os"],
3655
3659
  injection_detection: ["keyword", "lang"],
3656
3660
  intent_consistency: ["intent_keywords", "reason"]
3657
3661
  };
@@ -2109,6 +2109,13 @@
2109
2109
  "deny_mode": "deny_both",
2110
2110
  "scope": "home"
2111
2111
  },
2112
+ {
2113
+ "path": ".config/agentmoss/agent_moss_runtime.json",
2114
+ "risk_level": "critical",
2115
+ "desc": "AgentMoss 控制台运行时配置(规则启停/层级开关),写=agent 自行关闭安全检测",
2116
+ "deny_mode": "deny_write",
2117
+ "scope": "home"
2118
+ },
2112
2119
  {
2113
2120
  "path": ".config/agentmoss",
2114
2121
  "risk_level": "high",
@@ -2116,6 +2123,34 @@
2116
2123
  "deny_mode": "deny_write",
2117
2124
  "scope": "home"
2118
2125
  },
2126
+ {
2127
+ "path": ".config/agentgate/auth_token",
2128
+ "risk_level": "critical",
2129
+ "desc": "AgentGate 访问 token(拿到即可冒充 agent 调用网关、篡改审计/判定)",
2130
+ "deny_mode": "deny_both",
2131
+ "scope": "home"
2132
+ },
2133
+ {
2134
+ "path": ".config/agentgate/tool_name_map.json",
2135
+ "risk_level": "critical",
2136
+ "desc": "AgentGate 工具名映射文件(写=把危险工具伪装成只读/执行,绕过 L2 规则)",
2137
+ "deny_mode": "deny_write",
2138
+ "scope": "home"
2139
+ },
2140
+ {
2141
+ "path": ".config/agentgate",
2142
+ "risk_level": "high",
2143
+ "desc": "AgentGate 自身配置目录(token/工具名映射等),agent 可读但不可写(防篡改安全策略)",
2144
+ "deny_mode": "deny_write",
2145
+ "scope": "home"
2146
+ },
2147
+ {
2148
+ "path": ".local/share/agent_gate",
2149
+ "risk_level": "high",
2150
+ "desc": "AgentGate 数据库与归档目录(判定记录/审计),agent 可读但不可写(防篡改记录与归档)",
2151
+ "deny_mode": "deny_write",
2152
+ "scope": "home"
2153
+ },
2119
2154
  {
2120
2155
  "path": ".agentmoss/brain",
2121
2156
  "risk_level": "high",
@@ -2123,6 +2158,13 @@
2123
2158
  "deny_mode": "deny_write",
2124
2159
  "scope": "home"
2125
2160
  },
2161
+ {
2162
+ "path": ".agentmoss",
2163
+ "risk_level": "high",
2164
+ "desc": "AgentMoss 状态根目录(链状态库/instance 子目录/备份),agent 可读但不可写(防篡改判定链状态)",
2165
+ "deny_mode": "deny_write",
2166
+ "scope": "home"
2167
+ },
2126
2168
  {
2127
2169
  "path": ".pgpass",
2128
2170
  "risk_level": "critical",
@@ -2361,6 +2403,78 @@
2361
2403
  "scope": "home",
2362
2404
  "os": "windows"
2363
2405
  },
2406
+ {
2407
+ "path": ".config\\agentmoss\\auth_token",
2408
+ "risk_level": "critical",
2409
+ "desc": "AgentMoss 访问 token(Windows),拿到即可冒充调用分析接口/篡改判定",
2410
+ "deny_mode": "deny_both",
2411
+ "scope": "home",
2412
+ "os": "windows"
2413
+ },
2414
+ {
2415
+ "path": ".config\\agentmoss\\config.json",
2416
+ "risk_level": "critical",
2417
+ "desc": "AgentMoss 主配置(Windows),写=关闭安全检测",
2418
+ "deny_mode": "deny_both",
2419
+ "scope": "home",
2420
+ "os": "windows"
2421
+ },
2422
+ {
2423
+ "path": ".config\\agentmoss\\agent_moss_runtime.json",
2424
+ "risk_level": "critical",
2425
+ "desc": "AgentMoss 控制台运行时配置(Windows),写=agent 自行关闭安全检测",
2426
+ "deny_mode": "deny_write",
2427
+ "scope": "home",
2428
+ "os": "windows"
2429
+ },
2430
+ {
2431
+ "path": ".config\\agentmoss",
2432
+ "risk_level": "high",
2433
+ "desc": "AgentMoss 自身配置目录(Windows),agent 可读但不可写(防篡改关闭安全检测)",
2434
+ "deny_mode": "deny_write",
2435
+ "scope": "home",
2436
+ "os": "windows"
2437
+ },
2438
+ {
2439
+ "path": ".config\\agentgate\\auth_token",
2440
+ "risk_level": "critical",
2441
+ "desc": "AgentGate 访问 token(Windows),拿到即可冒充 agent 调用网关、篡改审计",
2442
+ "deny_mode": "deny_both",
2443
+ "scope": "home",
2444
+ "os": "windows"
2445
+ },
2446
+ {
2447
+ "path": ".config\\agentgate\\tool_name_map.json",
2448
+ "risk_level": "critical",
2449
+ "desc": "AgentGate 工具名映射文件(Windows),写=把危险工具伪装成只读,绕过 L2 规则",
2450
+ "deny_mode": "deny_write",
2451
+ "scope": "home",
2452
+ "os": "windows"
2453
+ },
2454
+ {
2455
+ "path": ".config\\agentgate",
2456
+ "risk_level": "high",
2457
+ "desc": "AgentGate 自身配置目录(Windows),agent 可读但不可写(防篡改安全策略)",
2458
+ "deny_mode": "deny_write",
2459
+ "scope": "home",
2460
+ "os": "windows"
2461
+ },
2462
+ {
2463
+ "path": ".local\\share\\agent_gate",
2464
+ "risk_level": "high",
2465
+ "desc": "AgentGate 数据库与归档目录(Windows),agent 可读但不可写(防篡改判定记录)",
2466
+ "deny_mode": "deny_write",
2467
+ "scope": "home",
2468
+ "os": "windows"
2469
+ },
2470
+ {
2471
+ "path": ".agentmoss",
2472
+ "risk_level": "high",
2473
+ "desc": "AgentMoss 状态根目录(Windows),agent 可读但不可写(防篡改判定链状态)",
2474
+ "deny_mode": "deny_write",
2475
+ "scope": "home",
2476
+ "os": "windows"
2477
+ },
2364
2478
  {
2365
2479
  "path": "C:\\ProgramData",
2366
2480
  "risk_level": "medium",
package/dist/server.js CHANGED
@@ -2986,7 +2986,7 @@ function _dedup(rules, category) {
2986
2986
  const seen = /* @__PURE__ */ new Set();
2987
2987
  const out = [];
2988
2988
  for (const r of rules) {
2989
- const k = keys.map((x) => String(r?.[x] ?? "")).join("\0");
2989
+ const k = keys.map((x) => x === "os" ? String(r?.os || "linux") : String(r?.[x] ?? "")).join("\0");
2990
2990
  if (seen.has(k)) continue;
2991
2991
  seen.add(k);
2992
2992
  out.push(r);
@@ -4206,7 +4206,11 @@ var init_runtime_config = __esm({
4206
4206
  dangerous_commands: ["pattern"],
4207
4207
  password_modify_consent: ["pattern"],
4208
4208
  user_deletion_consent: ["pattern"],
4209
- sensitive_path_access: ["path"],
4209
+ // ⚠️ 必须含 os:跨平台同名 path(.ssh / .aws / .agentmoss)各有独立条目。
4210
+ // 去重发生在 _filterRulesByOs 之前,若键只有 path,linux 条目(种子中先出现)
4211
+ // 会把 windows 同名条目顶掉 → Windows 真实运行时的目录级删除拦截静默失效
4212
+ // (2026-11 修;与 Python `_DEDUP_KEYS` 同步)。
4213
+ sensitive_path_access: ["path", "os"],
4210
4214
  injection_detection: ["keyword", "lang"],
4211
4215
  intent_consistency: ["intent_keywords", "reason"]
4212
4216
  };
@@ -14035,6 +14039,14 @@ async function analyzeRoute(c) {
14035
14039
  try {
14036
14040
  const body = await c.req.json();
14037
14041
  const req = AnalyzeRequestSchema.parse(normalizeObservablePayload(body));
14042
+ const unmappedTool = String(
14043
+ req.metadata?.unmapped_tool || ""
14044
+ );
14045
+ if (unmappedTool) {
14046
+ degradedNotes.push(
14047
+ `\u3010\u5DF2\u964D\u7EA7\u3011\u5DE5\u5177\u540D '${unmappedTool}' \u672A\u8BC6\u522B\u4E3A\u6807\u51C6\u52A8\u4F5C\u7C7B\u578B\uFF1A\u4F9D\u8D56\u52A8\u4F5C\u7C7B\u578B\u7684 L2 \u89C4\u5219\uFF08\u8BFB\u540E\u5199 / \u7EC4\u5408\u94FE / \u6388\u6743\uFF09\u53EF\u80FD\u672A\u751F\u6548\uFF1BL1\uFF08\u547D\u4EE4\u5185\u5BB9\uFF09\u4E0E L3 \u6B63\u5E38\u3002\u53EF\u5728 AgentGate \u914D\u7F6E AGENT_GATE_TOOL_NAME_MAP \u8865\u5145\u6620\u5C04\uFF08\u5982 {"${unmappedTool}": "read"}\uFF09\u3002`
14048
+ );
14049
+ }
14038
14050
  let osType = req.os_type;
14039
14051
  if (!osType) {
14040
14052
  osType = process.platform === "win32" ? "windows" : "linux";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenhkl/agent-moss",
3
- "version": "0.17.35",
3
+ "version": "0.17.37",
4
4
  "description": "Multi-layer security analysis engine for AI agents (TypeScript)",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",