@kenhkl/agent-moss 0.3.2 → 0.5.0

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/README.md CHANGED
@@ -66,13 +66,15 @@ const result = await resp.json();
66
66
 
67
67
  层1: 启发式静态检测 (<1ms)
68
68
  ├── 危险命令正则: 30 个模式(rm 分级检测: 5 条严格→宽松规则)
69
+ ├── → high/critical → 直接 Deny
70
+ ├── → 内联脚本 file_access 转层3(避免 'python -c "cat /etc/shadow"' 假阳性)
69
71
  ├── 注入关键词: 56 个中英双语关键词(9 类: 指令覆盖/角色劫持/命令注入/...)
70
72
  └── 自定义规则: AGENT_MOSS_CUSTOM_RULES 环境变量注入
71
73
 
72
74
  层2: 逻辑规则检测 (<1ms)
73
75
  ├── Rule 1: read-before-write(有历史但无读取 → flag)
74
76
  ├── Rule 2: 意图偏离(读取意图 vs 删除动作)
75
- ├── Rule 3: 敏感路径访问(20 条路径,4 级风险: critical/high/medium/low)
77
+ ├── Rule 3: 敏感路径访问(20 条路径 + 5 条凭据文件, \b边界匹配, 读写均拦截)
76
78
  ├── Rule 4: 危险操作(通配符删除 + 重定向覆盖 /etc/ /boot/ /proc/)
77
79
  ├── Rule 5: 提权检测(sudo/su/chmod u+s/setuid)
78
80
  └── Rule 6: 横向移动(ssh/scp/rsync,排除 localhost)
@@ -143,7 +145,7 @@ ts/src/
143
145
  └── engine/
144
146
  ├── types.ts # 核心类型 (SecurityJudgment, LLMConfig, ...)
145
147
  ├── coordinator.ts # 三层协调器 + 两级快速放行白名单
146
- ├── heuristic.ts # 层1: 30 危险模式 + 56 注入关键词
148
+ ├── heuristic.ts # 层1: 30 危险模式 + 56 注入关键词 + isInlineScriptCommand
147
149
  ├── logic-rules.ts # 层2: 6 条规则 + 20 敏感路径
148
150
  ├── llm-analyzer.ts # 层3: LLM 分析 (缓存 + 重试 + fail-closed)
149
151
  ├── script-analyzer.ts # 脚本内容预扫描 (18 个可疑模式)