@kenhkl/agent-moss 0.11.4 → 0.11.5

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.
@@ -2292,7 +2292,7 @@ function runHeuristicCheck(input) {
2292
2292
  }
2293
2293
  }
2294
2294
  }
2295
- const injectionText = `${input.aNext.actionType} ${input.aNext.actionDetail} ${input.reason || ""} ${input.promptSession || ""}`.toLowerCase();
2295
+ const injectionText = isSearchActionType(input.aNext.actionType) ? `${input.aNext.actionType} ${input.reason || ""} ${input.promptSession || ""}`.toLowerCase() : `${input.aNext.actionType} ${input.aNext.actionDetail} ${input.reason || ""} ${input.promptSession || ""}`.toLowerCase();
2296
2296
  const injectionHits = checkInjectionKeywords(injectionText, agentExt?.extra_injection_keywords);
2297
2297
  if (injectionHits.length > 0) {
2298
2298
  const topHit = injectionHits.reduce((a, b) => severityRank(a.riskLevel) >= severityRank(b.riskLevel) ? a : b);
@@ -2419,6 +2419,10 @@ function severityRank(s) {
2419
2419
  const ranks = { low: 1, medium: 2, high: 3, critical: 4 };
2420
2420
  return ranks[s] || 0;
2421
2421
  }
2422
+ function isSearchActionType(actionType) {
2423
+ const at = actionType.toLowerCase();
2424
+ return SEARCH_ACTION_PREFIXES.some((p) => at.startsWith(p)) || ["websearch", "web_search", "search", "query"].includes(at);
2425
+ }
2422
2426
  function checkSensitivePath(command, cwd, agentExt) {
2423
2427
  const expandedCwd = cwd.replace(/^~/, process.env.HOME || "/home/user");
2424
2428
  const isWriteOpFlag = isWriteOperation("", command);
@@ -2686,7 +2690,7 @@ function checkLateralMovement(actionDetail) {
2686
2690
  }
2687
2691
  return null;
2688
2692
  }
2689
- var INJECTION_KEYWORDS, DANGEROUS_PATTERNS, SENSITIVE_EXCLUDED_PREFIXES;
2693
+ var INJECTION_KEYWORDS, DANGEROUS_PATTERNS, SENSITIVE_EXCLUDED_PREFIXES, SEARCH_ACTION_PREFIXES;
2690
2694
  var init_heuristic = __esm({
2691
2695
  "src/engine/heuristic.ts"() {
2692
2696
  "use strict";
@@ -2852,6 +2856,7 @@ var init_heuristic = __esm({
2852
2856
  { pattern: /\b(useradd|luseradd|groupadd|usermod|lusermod|groupmod|lgroupmod)\b[^&|;]*?\s-p\b/i, severity: "high", description: "\u68C0\u6D4B\u5230\u901A\u8FC7 -p \u53C2\u6570\u8BBE\u7F6E\u6216\u4FEE\u6539\u5BC6\u7801 (useradd/usermod/groupmod)", riskType: "script_execution" }
2853
2857
  ];
2854
2858
  SENSITIVE_EXCLUDED_PREFIXES = ["memory-", "skill-", "skill-manager-", "mailbox-", "app-"];
2859
+ SEARCH_ACTION_PREFIXES = ["search-", "web-", "browser-", "query-", "websearch", "web_search"];
2855
2860
  }
2856
2861
  });
2857
2862