@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.
package/dist/server.js CHANGED
@@ -2302,7 +2302,7 @@ function runHeuristicCheck(input) {
2302
2302
  }
2303
2303
  }
2304
2304
  }
2305
- const injectionText = `${input.aNext.actionType} ${input.aNext.actionDetail} ${input.reason || ""} ${input.promptSession || ""}`.toLowerCase();
2305
+ 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();
2306
2306
  const injectionHits = checkInjectionKeywords(injectionText, agentExt?.extra_injection_keywords);
2307
2307
  if (injectionHits.length > 0) {
2308
2308
  const topHit = injectionHits.reduce((a, b) => severityRank(a.riskLevel) >= severityRank(b.riskLevel) ? a : b);
@@ -2429,6 +2429,10 @@ function severityRank(s) {
2429
2429
  const ranks = { low: 1, medium: 2, high: 3, critical: 4 };
2430
2430
  return ranks[s] || 0;
2431
2431
  }
2432
+ function isSearchActionType(actionType) {
2433
+ const at = actionType.toLowerCase();
2434
+ return SEARCH_ACTION_PREFIXES.some((p) => at.startsWith(p)) || ["websearch", "web_search", "search", "query"].includes(at);
2435
+ }
2432
2436
  function checkSensitivePath(command, cwd, agentExt) {
2433
2437
  const expandedCwd = cwd.replace(/^~/, process.env.HOME || "/home/user");
2434
2438
  const isWriteOpFlag = isWriteOperation("", command);
@@ -2696,7 +2700,7 @@ function checkLateralMovement(actionDetail) {
2696
2700
  }
2697
2701
  return null;
2698
2702
  }
2699
- var INJECTION_KEYWORDS, DANGEROUS_PATTERNS, SENSITIVE_EXCLUDED_PREFIXES;
2703
+ var INJECTION_KEYWORDS, DANGEROUS_PATTERNS, SENSITIVE_EXCLUDED_PREFIXES, SEARCH_ACTION_PREFIXES;
2700
2704
  var init_heuristic = __esm({
2701
2705
  "src/engine/heuristic.ts"() {
2702
2706
  "use strict";
@@ -2862,6 +2866,7 @@ var init_heuristic = __esm({
2862
2866
  { 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" }
2863
2867
  ];
2864
2868
  SENSITIVE_EXCLUDED_PREFIXES = ["memory-", "skill-", "skill-manager-", "mailbox-", "app-"];
2869
+ SEARCH_ACTION_PREFIXES = ["search-", "web-", "browser-", "query-", "websearch", "web_search"];
2865
2870
  }
2866
2871
  });
2867
2872