ai-helper-agent 1.3.3 → 1.3.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/security.js +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-helper-agent",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "AI Helper 本地代理服务 - 为 Chrome 扩展提供本地文件读写和系统命令执行能力",
5
5
  "type": "module",
6
6
  "main": "./src/server.js",
package/src/security.js CHANGED
@@ -94,9 +94,9 @@ const BLACKLIST_PATTERNS = [
94
94
  // 修改根目录权限
95
95
  /^\s*chmod\s+(-R\s+)?(0?777|a\+rwx)\s+\//,
96
96
  /^\s*chown\s+-R\s+\S+\s+\//,
97
- // Shell 命令替换注入(仅匹配反引号内的可执行命令模式)
98
- /`[^`]*`/,
99
- /\$\([^)]*\)/,
97
+ // Shell 命令替换注入 — 允许 echo/printf 等纯输出命令中使用
98
+ /^\s*(?!(echo|printf|cat|head|tail|wc|ls|pwd|date|whoami|hostname|uname|id|env|printenv|which|type)\s).*`[^`]*`/,
99
+ /^\s*(?!(echo|printf|cat|head|tail|wc|ls|pwd|date|whoami|hostname|uname|id|env|printenv|which|type)\s).*\$\s*\([^)]*\)/,
100
100
  ];
101
101
 
102
102
  const SCRIPT_EXTENSIONS = '(sh|bash|zsh|py|js|mjs|rb|pl|php|lua)';