@kenhkl/agent-moss 0.12.4 → 0.12.6

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.
@@ -323,6 +323,12 @@
323
323
  "risk_level": "medium",
324
324
  "risk_type": "data_exfiltration",
325
325
  "reason": "导出敏感凭证"
326
+ },
327
+ {
328
+ "pattern": "(?:\\$\\(|`)\\s*(?:\\S+=\\S*\\s+)*(?:touch|rm|mkdir|mv|cp|dd|tee|truncate|chmod|chown|mkfifo|mknod|ln|shred|mkfs|nc|ncat|socat|bash|sh|zsh|dash|python|python3|perl|ruby|node|php|eval|exec|base64|sudo|su)\\b",
329
+ "risk_level": "critical",
330
+ "risk_type": "script_execution",
331
+ "reason": "检测到命令替换隐藏执行($(...)/反引号载荷含写/执行命令),可能产生文件系统副作用"
326
332
  }
327
333
  ],
328
334
  "injection_detection": [
package/dist/server.js CHANGED
@@ -4667,10 +4667,10 @@ function formatPromptHistory(promptHistory, maxTextChars = 500) {
4667
4667
  const lines = [];
4668
4668
  for (let i = 0; i < promptHistory.length; i++) {
4669
4669
  const turn = promptHistory[i];
4670
- const text = (turn?.text || "").trim();
4670
+ const text = (typeof turn === "string" ? turn : turn?.text || "").trim();
4671
4671
  if (!text) continue;
4672
4672
  let line = ` \u7B2C${i + 1}\u8F6E\u7528\u6237\u610F\u56FE: ${text.slice(0, maxTextChars)}`;
4673
- const actions = turn?.actions;
4673
+ const actions = typeof turn === "string" ? void 0 : turn?.actions;
4674
4674
  if (actions && actions.length > 0) {
4675
4675
  const types = actions.map((a) => a?.actionType).filter((t) => typeof t === "string" && t.length > 0);
4676
4676
  if (types.length > 0) {