dsh-code-security 0.2.2 → 0.2.3

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.en.md CHANGED
@@ -18,7 +18,7 @@ A DeepSeek Harness plugin for AI code security review: deterministic rule engine
18
18
  | `secure_policy_show` | Show .code-security.json | no |
19
19
  | `secure_policy_set` | Replace policy JSON | approval |
20
20
 
21
- 40+ deterministic rules: injection, deserialization, weak crypto, secrets, dangerous config, sensitive logging, path traversal, SSRF.
21
+ 40+ deterministic rules: injection, deserialization, weak crypto (including shell TLS bypass flags), secrets, dangerous config, sensitive logging, path traversal, SSRF.
22
22
 
23
23
  ```bash
24
24
  dsh plugin --profile web add dsh-code-security
package/README.md CHANGED
@@ -22,7 +22,7 @@ DeepSeek Harness AI 代码安全审查插件:确定性规则引擎 + git diff
22
22
 
23
23
  - 注入:eval / exec / shell=True / SQL 拼接 / innerHTML
24
24
  - 反序列化:pickle / yaml.load / ObjectInputStream / Marshal / unserialize
25
- - 加密:弱哈希、ECB、硬编码 IV/密钥、JWT none、TLS 校验关闭
25
+ - 加密:弱哈希、ECB、硬编码 IV/密钥、JWT none、TLS 校验关闭、Shell TLS 绕过(curl -k / wget --no-check-certificate / git sslVerify=false)
26
26
  - 凭据:硬编码密码、令牌、私钥、高熵密钥
27
27
  - 配置:chmod 777、Docker privileged / latest、npm audit=false、CORS *
28
28
  - 泄露:敏感日志、错误堆栈外发、路径穿越、SSRF
@@ -59,7 +59,7 @@ secure_deps { target: . }
59
59
  ## 工程
60
60
 
61
61
  ```bash
62
- pnpm test # 构建 + 23 个测试
62
+ pnpm test # 构建 + 24 个测试
63
63
  ```
64
64
 
65
65
  MIT
package/lib/rules.js CHANGED
@@ -32,6 +32,7 @@ export const RULES = Object.freeze([
32
32
  { id: 'SEC-204', title: 'JWT alg none / 不校验签名', cwe: 'CWE-347', severity: 'critical', confidence: 'high', languages: JS, patterns: [/['"]?alg['"]?\s*[:=]\s*['"]?none['"]?/i, /\bjwt\.verify\s*\([^)]*\{\s*algorithms\s*:\s*\[\s*['"]none/i], message: 'JWT 允许 none 算法或未校验签名。' },
33
33
  { id: 'SEC-205', title: 'TLS 校验被禁用', cwe: 'CWE-295', severity: 'high', confidence: 'high', languages: ALL, patterns: [/rejectUnauthorized\s*:\s*false/, /\bverify\s*=\s*False/, /InsecureSkipVerify\s*:\s*true/], message: 'TLS 证书校验被显式关闭。' },
34
34
  { id: 'SEC-206', title: 'Math.random 用于安全敏感逻辑', cwe: 'CWE-330', severity: 'low', confidence: 'low', languages: JS, patterns: [/\bMath\.random\s*\(/], message: '使用非密码学安全的 Math.random。' },
35
+ { id: 'SEC-207', title: 'Shell 关闭 TLS 证书校验', cwe: 'CWE-295', severity: 'high', confidence: 'high', languages: SHELL, patterns: [/\bcurl\b[^\n]*(?:-k\b|--insecure\b)/, /\bwget\b[^\n]*--no-check-certificate\b/, /\bgit\b[^\n]*-c\s+http\.sslVerify\s*=\s*false\b/i, /\bnpm\b[^\n]*--strict-ssl\s*=\s*false\b/i], message: '命令行下载/访问工具关闭了 TLS 证书校验。' },
35
36
  { id: 'SEC-301', title: '硬编码密码', cwe: 'CWE-798', severity: 'critical', confidence: 'high', languages: ALL, patterns: [/(?:password|passwd|pwd)\s*[:=]\s*['"][^'"]{4,}['"]/i], message: '密码以明文硬编码在源码中。' },
36
37
  { id: 'SEC-302', title: '硬编码令牌 / API 密钥', cwe: 'CWE-798', severity: 'high', confidence: 'medium', languages: ALL, patterns: [/(?:api[_-]?key|secret[_-]?key|access[_-]?key|auth[_-]?token)\s*[:=]\s*['"][A-Za-z0-9_\-]{16,}['"]/i], message: '访问令牌或 API 密钥以字面量硬编码。' },
37
38
  { id: 'SEC-303', title: '私钥材料', cwe: 'CWE-798', severity: 'critical', confidence: 'high', languages: ALL, patterns: [/-----BEGIN (?:RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----/], message: '检测到私钥文件内容。', fileLevel: true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-code-security",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "DSH AI 代码安全审查插件:secure_scan/secure_diff/secure_fix_verify/secure_report/secure_export/secure_baseline/secure_deps/secure_policy_show/secure_policy_set 九工具,40+ 确定性规则、密钥熵检测、git diff/staged 审查、SARIF 导出、基线接受与 SBOM-lite,零运行时依赖。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",