@deepwhale-cn/dsh-least-privilege 0.0.0-stage → 0.1.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 +58 -2
- package/bin/cli.mjs +5 -0
- package/cordis.patch.yml +4 -0
- package/docs/report.html +79 -0
- package/docs/report.png +0 -0
- package/lib/index.js +10 -0
- package/package.json +60 -3
- package/rules/01-root-container.json +14 -0
- package/rules/02-wildcard-permission.json +14 -0
- package/rules/03-cors-any.json +14 -0
- package/rules/04-admin-scope.json +28 -0
- package/skill/least-privilege.md +49 -0
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @deepwhale-cn/dsh-least-privilege
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**最小权限检查** —— 容器跑 root、IAM 通配、CORS 全开、令牌申请 admin。
|
|
4
|
+
|
|
5
|
+
## 不装它会怎样
|
|
6
|
+
|
|
7
|
+
你的部署里有这么一段:
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
services:
|
|
11
|
+
app:
|
|
12
|
+
privileged: true
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
当时是为了让容器能访问某个设备,后来那个需求没了,**但这行留下了**。
|
|
16
|
+
|
|
17
|
+
哪天应用出了个漏洞,攻击者进到容器里 —— 而因为 `privileged`,
|
|
18
|
+
他拿到的几乎是**宿主机**。
|
|
19
|
+
|
|
20
|
+
**权限过宽是入侵的放大器**,而且它**没有任何症状** —— 系统照常跑,
|
|
21
|
+
直到出事那天你才发现那把钥匙能开所有的门。
|
|
22
|
+
|
|
23
|
+
## 它查什么
|
|
24
|
+
|
|
25
|
+
| 级别 | 内容 |
|
|
26
|
+
|---|---|
|
|
27
|
+
| 🔴 高 | 容器跑 root / `--privileged` · IAM `Action: *` |
|
|
28
|
+
| 🟡 中 | CORS 允许所有来源 · 令牌申请 admin/全量 scope |
|
|
29
|
+
|
|
30
|
+
## 安装
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
dsh plugin --profile web add @deepwhale-cn/dsh-least-privilege
|
|
34
|
+
# 或纯 CLI
|
|
35
|
+
npx @deepwhale-cn/dsh-least-privilege
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 用法
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
dsh-least-privilege --demo
|
|
42
|
+
dsh-least-privilege --list-rules
|
|
43
|
+
dsh-least-privilege --html r.html
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+
## 边界
|
|
49
|
+
|
|
50
|
+
- **只查「明显过宽」的写法** —— 权限偏大但没用通配符的,需要人工评审。
|
|
51
|
+
- **不解析云厂商实际生效策略** —— IAM 有继承/条件/边界,只看仓库里字面写的。
|
|
52
|
+
- **Dockerfile 可能多阶段** —— builder 阶段的 `USER root` 通常无害,需你判断。
|
|
53
|
+
- 与 [dsh-data-scan](https://github.com/feely0208/dsh-data-scan) 分工:那个查数据,这个查**访问数据的权限**。
|
|
54
|
+
|
|
55
|
+
本插件是一个工具。使用者必须遵守所在地区法律法规,**对使用本项目造成的任何后果自行承担责任。**
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT © 深鲸 DeepWhale
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runCli } from '@deepwhale-cn/dsh-guard-core/cli';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
runCli({ pkgRoot: join(dirname(fileURLToPath(import.meta.url)), '..'), meta: { name: '深鲸守护 · 最小权限检查' } });
|
package/cordis.patch.yml
ADDED
package/docs/report.html
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8">
|
|
2
|
+
<title>深鲸守护 · 最小权限检查 · 检查报告</title>
|
|
3
|
+
<style>
|
|
4
|
+
:root{--bg:#0b1018;--fg:#e6edf6;--muted:#8b9bb4;--line:#1e2a3a;--card:#121a26}
|
|
5
|
+
*{box-sizing:border-box}
|
|
6
|
+
body{margin:0;background:var(--bg);color:var(--fg);font:14px/1.6 -apple-system,"PingFang SC","Microsoft YaHei",sans-serif;padding:32px}
|
|
7
|
+
.wrap{max-width:1180px;margin:0 auto}
|
|
8
|
+
h1{font-size:22px;margin:0 0 4px}
|
|
9
|
+
.sub{color:var(--muted);font-size:13px;margin-bottom:20px}
|
|
10
|
+
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin-bottom:20px}
|
|
11
|
+
.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:14px 16px}
|
|
12
|
+
.card .k{color:var(--muted);font-size:12px;margin-bottom:6px}
|
|
13
|
+
.card .v{font-size:20px;font-weight:700}
|
|
14
|
+
.chip{display:inline-block;padding:3px 10px;border-radius:999px;margin:0 6px 6px 0;font-size:13px;
|
|
15
|
+
border:1px solid var(--c);color:var(--c)}
|
|
16
|
+
.chip b{font-size:15px}
|
|
17
|
+
table{width:100%;border-collapse:collapse;background:var(--card);border:1px solid var(--line);border-radius:12px;overflow:hidden}
|
|
18
|
+
th,td{text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:top;font-size:13px}
|
|
19
|
+
th{color:var(--muted);font-weight:500;background:#0e1622}
|
|
20
|
+
tr:last-child td{border-bottom:0}
|
|
21
|
+
.dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--c);margin-right:6px}
|
|
22
|
+
.t{font-weight:600;margin-bottom:2px}
|
|
23
|
+
.src{color:var(--muted);font-size:12px}
|
|
24
|
+
code{font-family:ui-monospace,Menlo,monospace;font-size:12px;color:#7dd3fc}
|
|
25
|
+
.ev{color:var(--muted);font-size:12px;margin-top:2px;word-break:break-all}
|
|
26
|
+
.adv{color:var(--muted);font-size:12px;max-width:260px}
|
|
27
|
+
.ok{background:#0d2b1a;border:1px solid #1d7a4a;color:#4ade80;padding:16px;border-radius:12px;margin-bottom:20px}
|
|
28
|
+
.warn{background:#2b1f0d;border:1px solid #a16207;color:#fbbf24;padding:12px 16px;border-radius:12px;margin-bottom:20px;font-size:13px}
|
|
29
|
+
footer{color:var(--muted);font-size:12px;margin-top:22px;padding-top:14px;border-top:1px solid var(--line)}
|
|
30
|
+
footer p{margin:3px 0}
|
|
31
|
+
</style></head><body><div class="wrap">
|
|
32
|
+
<h1>深鲸守护 · 最小权限检查</h1>
|
|
33
|
+
<div class="sub">查权限过宽:容器跑 root、IAM 通配、CORS 全开、令牌申请 admin —— 权限过宽是入侵的放大器</div>
|
|
34
|
+
|
|
35
|
+
<div class="cards">
|
|
36
|
+
<div class="card"><div class="k">扫描文件</div><div class="v">5</div></div>
|
|
37
|
+
<div class="card"><div class="k">检查规则</div><div class="v">4<span style="font-size:13px;color:var(--muted)">/4</span></div></div>
|
|
38
|
+
<div class="card"><div class="k">命中</div><div class="v" style="color:#ea580c">4</div></div>
|
|
39
|
+
<div class="card"><div class="k">已跳过目录</div><div class="v">0</div></div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div style="margin-bottom:16px"><span class="chip" style="--c:#ea580c">高 <b>2</b></span><span class="chip" style="--c:#ca8a04">中 <b>2</b></span></div>
|
|
47
|
+
<table><thead><tr><th>级别</th><th>问题</th><th>位置 / 证据</th><th>建议</th></tr></thead>
|
|
48
|
+
<tbody>
|
|
49
|
+
<tr class="sev-high">
|
|
50
|
+
<td><span class="dot" style="--c:#ea580c"></span>高</td>
|
|
51
|
+
<td><div class="t">容器以 root 运行或使用特权模式</div><div class="src">OWASP Docker Security Cheat Sheet —— 容器应以非 root 用户运行;CIS Docker Benchmark 4.1(Create a user for the container)· 5.4(不启用 privileged)</div></td>
|
|
52
|
+
<td><code>Dockerfile:2</code><div class="ev">USER root</div></td>
|
|
53
|
+
<td class="adv">以 root 运行的容器,一旦被突破(应用漏洞 / 供应链投毒),攻击者直接拿到容器内最高权限,并可能借助内核漏洞逃逸到宿主。--privileged 更甚:几乎等于把宿主交出去。做法:Dockerfile 里加非 root 用户 + USER,去掉 --privileged,按需加 cap_drop。</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="sev-high">
|
|
56
|
+
<td><span class="dot" style="--c:#ea580c"></span>高</td>
|
|
57
|
+
<td><div class="t">权限策略出现通配符(Action/Resource 为 *)</div><div class="src">AWS IAM 最佳实践 —— 授予最小权限,避免在策略中使用通配符;CIS Benchmark · 最小权限原则</div></td>
|
|
58
|
+
<td><code>iam-policy.json:1</code><div class="ev">"Action":"*"</div></td>
|
|
59
|
+
<td class="adv"><code>"Action": "*"</code> 或 <code>"Resource": "*"</code> 意味着这条凭据能做任何事、访问任何资源。一旦泄露(日志、CI、前端),攻击者拿到的是整个账号。改成按需列举具体 Action 与资源 ARN。</td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr class="sev-medium">
|
|
62
|
+
<td><span class="dot" style="--c:#ca8a04"></span>中</td>
|
|
63
|
+
<td><div class="t">CORS 允许所有来源</div><div class="src">OWASP — CORS 配置错误(WSTG-CLNT-11);MDN — Access-Control-Allow-Origin</div></td>
|
|
64
|
+
<td><code>server.js:1</code><div class="ev">cors()</div></td>
|
|
65
|
+
<td class="adv"><code>Access-Control-Allow-Origin: *</code> 让任意网站都能带着用户凭证调你的接口。如果同时开了 <code>Allow-Credentials: true</code>,浏览器会直接拒绝(但有些框架会「变通」成回显 Origin —— 那样更危险)。改成来源白名单。</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr class="sev-medium">
|
|
68
|
+
<td><span class="dot" style="--c:#ca8a04"></span>中</td>
|
|
69
|
+
<td><div class="t">申请了 admin / 全量 scope 的令牌</div><div class="src">OAuth 2.0 安全最佳实践(BCP)—— 应使用最小 scope;GitHub/云厂商文档均建议按需授权</div></td>
|
|
70
|
+
<td><code>.env:1</code><div class="ev">SCOPE=admin repo</div></td>
|
|
71
|
+
<td class="adv">令牌申请了 <code>admin</code> / <code>*</code> / <code>repo</code>(GitHub 的 repo 含写权限)这类全量 scope,而代码只用到其中一小部分。令牌泄露时,攻击者拿到的是你申请的全部权限 —— 不是用到的部分。按实际调用的接口裁剪 scope。</td>
|
|
72
|
+
</tr></tbody></table>
|
|
73
|
+
|
|
74
|
+
<footer>
|
|
75
|
+
<p>扫描范围:<code>tests/fixtures/fail/demo-project</code> · 5 个文件</p>
|
|
76
|
+
<p>规则库:— · 生成时间:2026-10-13 02:49:56</p>
|
|
77
|
+
<p></p>
|
|
78
|
+
</footer>
|
|
79
|
+
</div></body></html>
|
package/docs/report.png
ADDED
|
Binary file
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createPlugin, pkgRootFrom } from '@deepwhale-cn/dsh-guard-core/plugin';
|
|
2
|
+
|
|
3
|
+
export const { name, inject, apply } = createPlugin({
|
|
4
|
+
name: 'least-privilege',
|
|
5
|
+
pkgRoot: pkgRootFrom(import.meta.url),
|
|
6
|
+
skillFile: 'skill/least-privilege.md',
|
|
7
|
+
binFile: 'bin/cli.mjs',
|
|
8
|
+
description: '查权限过宽:容器跑 root、IAM 通配、CORS 全开、令牌申请 admin —— 权限过宽是入侵的放大器',
|
|
9
|
+
whenToUse: 'TODO:写清什么时候该用(用户会说的话也列上)',
|
|
10
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepwhale-cn/dsh-least-privilege",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "查权限过宽:容器跑 root、IAM 通配、CORS 全开、令牌申请 admin —— 权限过宽是入侵的放大器",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"dsh",
|
|
9
|
+
"dsh-plugin",
|
|
10
|
+
"deepseek-harness",
|
|
11
|
+
"plugin",
|
|
12
|
+
"skill",
|
|
13
|
+
"security",
|
|
14
|
+
"guard",
|
|
15
|
+
"least-privilege",
|
|
16
|
+
"least-privilege",
|
|
17
|
+
"iam",
|
|
18
|
+
"rbac",
|
|
19
|
+
"cors",
|
|
20
|
+
"container-security",
|
|
21
|
+
"权限"
|
|
22
|
+
],
|
|
23
|
+
"files": [
|
|
24
|
+
"lib",
|
|
25
|
+
"skill",
|
|
26
|
+
"bin",
|
|
27
|
+
"rules",
|
|
28
|
+
"docs",
|
|
29
|
+
"cordis.patch.yml",
|
|
30
|
+
"README.md"
|
|
31
|
+
],
|
|
32
|
+
"main": "./lib/index.js",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": "./lib/index.js",
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"bin": {
|
|
38
|
+
"dsh-least-privilege": "./bin/cli.mjs"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"dsh": ">=0.1.0-rc.6",
|
|
42
|
+
"node": ">=18"
|
|
43
|
+
},
|
|
44
|
+
"dsh": {
|
|
45
|
+
"bundle": {
|
|
46
|
+
"patch": "./cordis.patch.yml"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@deepwhale-cn/dsh-guard-core": "^0.7.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@deepseek-ai/dsh-skill": "*"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/feely0208/dsh-least-privilege.git"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://www.deepwhale.org.cn/skills.html",
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/feely0208/dsh-least-privilege/issues"
|
|
62
|
+
}
|
|
6
63
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "LP-ROOT-CONTAINER",
|
|
3
|
+
"title": "容器以 root 运行或使用特权模式",
|
|
4
|
+
"severity": "high",
|
|
5
|
+
"source": "OWASP Docker Security Cheat Sheet —— 容器应以非 root 用户运行;CIS Docker Benchmark 4.1(Create a user for the container)· 5.4(不启用 privileged)",
|
|
6
|
+
"advice": "以 root 运行的容器,一旦被突破(应用漏洞 / 供应链投毒),攻击者直接拿到容器内最高权限,并可能借助内核漏洞逃逸到宿主。--privileged 更甚:几乎等于把宿主交出去。做法:Dockerfile 里加非 root 用户 + USER,去掉 --privileged,按需加 cap_drop。",
|
|
7
|
+
"check": {
|
|
8
|
+
"type": "file-pattern",
|
|
9
|
+
"pattern": "(--privileged|--cap-add[= ]ALL|user:\\s*[\"']?root|USER\\s+root|user:\\s*0\\b)",
|
|
10
|
+
"flags": "gi",
|
|
11
|
+
"paths": ["Dockerfile", "**/Dockerfile", "**/Dockerfile.*", "docker-compose.yml", "docker-compose.yaml", "**/docker-compose*.yml", "**/docker-compose*.yaml", "*.k8s.yml", "**/deployment*.yaml", "**/pod*.yaml"],
|
|
12
|
+
"max": 20
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "LP-WILDCARD-PERM",
|
|
3
|
+
"title": "权限策略出现通配符(Action/Resource 为 *)",
|
|
4
|
+
"severity": "high",
|
|
5
|
+
"source": "AWS IAM 最佳实践 —— 授予最小权限,避免在策略中使用通配符;CIS Benchmark · 最小权限原则",
|
|
6
|
+
"advice": "`\"Action\": \"*\"` 或 `\"Resource\": \"*\"` 意味着这条凭据能做任何事、访问任何资源。一旦泄露(日志、CI、前端),攻击者拿到的是整个账号。改成按需列举具体 Action 与资源 ARN。",
|
|
7
|
+
"check": {
|
|
8
|
+
"type": "file-pattern",
|
|
9
|
+
"pattern": "\"(Action|Resource|Principal)\"\\s*:\\s*(\"\\*\"|\\[\\s*\"\\*\"\\s*\\])",
|
|
10
|
+
"flags": "g",
|
|
11
|
+
"exts": [".json", ".yml", ".yaml", ".tf", ".template"],
|
|
12
|
+
"max": 20
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "LP-CORS-ANY",
|
|
3
|
+
"title": "CORS 允许所有来源",
|
|
4
|
+
"severity": "medium",
|
|
5
|
+
"source": "OWASP — CORS 配置错误(WSTG-CLNT-11);MDN — Access-Control-Allow-Origin",
|
|
6
|
+
"advice": "`Access-Control-Allow-Origin: *` 让任意网站都能带着用户凭证调你的接口。如果同时开了 `Allow-Credentials: true`,浏览器会直接拒绝(但有些框架会「变通」成回显 Origin —— 那样更危险)。改成来源白名单。",
|
|
7
|
+
"check": {
|
|
8
|
+
"type": "file-pattern",
|
|
9
|
+
"pattern": "(Access-Control-Allow-Origin[\"']?\\s*[:=]\\s*[\"']?\\*|origin\\s*:\\s*[\"']\\*[\"']|cors\\(\\s*\\))",
|
|
10
|
+
"flags": "gi",
|
|
11
|
+
"exts": [".js", ".mjs", ".cjs", ".ts", ".py", ".go", ".java", ".rb", ".php", ".conf", ".yml", ".yaml"],
|
|
12
|
+
"max": 20
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "LP-ADMIN-SCOPE",
|
|
3
|
+
"title": "申请了 admin / 全量 scope 的令牌",
|
|
4
|
+
"severity": "medium",
|
|
5
|
+
"source": "OAuth 2.0 安全最佳实践(BCP)—— 应使用最小 scope;GitHub/云厂商文档均建议按需授权",
|
|
6
|
+
"advice": "令牌申请了 `admin` / `*` / `repo`(GitHub 的 repo 含写权限)这类全量 scope,而代码只用到其中一小部分。令牌泄露时,攻击者拿到的是你申请的全部权限 —— 不是用到的部分。按实际调用的接口裁剪 scope。",
|
|
7
|
+
"check": {
|
|
8
|
+
"type": "file-pattern",
|
|
9
|
+
"pattern": "(scope|scopes|permissions|SCOPE)[\"']?\\s*[:=]\\s*[\"']?[^\"'\\n]*(admin|\\*|repo\\b|write:org|full_access)[^\"'\\n]*",
|
|
10
|
+
"flags": "gi",
|
|
11
|
+
"exts": [
|
|
12
|
+
".js",
|
|
13
|
+
".mjs",
|
|
14
|
+
".cjs",
|
|
15
|
+
".ts",
|
|
16
|
+
".py",
|
|
17
|
+
".go",
|
|
18
|
+
".java",
|
|
19
|
+
".yml",
|
|
20
|
+
".yaml",
|
|
21
|
+
".json",
|
|
22
|
+
".env",
|
|
23
|
+
".ini",
|
|
24
|
+
".conf"
|
|
25
|
+
],
|
|
26
|
+
"max": 20
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 最小权限检查
|
|
2
|
+
|
|
3
|
+
查权限过宽:**容器跑 root、IAM 通配、CORS 全开、令牌申请 admin**。
|
|
4
|
+
|
|
5
|
+
## 一、为什么「权限过宽」比「有漏洞」更值得先修
|
|
6
|
+
|
|
7
|
+
漏洞是「可能被利用」,权限过宽是**「一旦被利用就全完了」**。
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
有漏洞 + 最小权限 → 攻击者拿到一个受限身份,能做的有限
|
|
11
|
+
有漏洞 + Action:* → 攻击者拿到整个账号
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**权限过宽是入侵的放大器。** 而且它没有任何症状 —— 系统照常运行,
|
|
15
|
+
直到出事那天你才发现那把钥匙能开所有的门。
|
|
16
|
+
|
|
17
|
+
## 二、它查什么
|
|
18
|
+
|
|
19
|
+
| 级别 | 项 | 依据 |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| 🔴 高 | **容器跑 root / `--privileged`** | OWASP Docker Cheat Sheet · CIS Docker Benchmark |
|
|
22
|
+
| 🔴 高 | **IAM `Action: *` / `Resource: *`** | AWS IAM 最佳实践 |
|
|
23
|
+
| 🟡 中 | **CORS 允许所有来源** | OWASP CORS 配置错误 |
|
|
24
|
+
| 🟡 中 | **令牌申请 admin / 全量 scope** | OAuth 2.0 安全最佳实践(最小 scope)|
|
|
25
|
+
|
|
26
|
+
## 三、怎么用
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
<cli 路径> --demo
|
|
30
|
+
<cli 路径> --list-rules
|
|
31
|
+
<cli 路径> --html r.html
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 四、边界
|
|
35
|
+
|
|
36
|
+
- **只查「明显过宽」的写法**:通配符、root、`*`、admin。
|
|
37
|
+
「权限偏大但没用通配符」的情况需要人工评审,本工具看不出来。
|
|
38
|
+
- **不解析云厂商的实际生效策略**:IAM 有继承、条件、边界策略,
|
|
39
|
+
本工具只看仓库里**字面写的**策略文件。
|
|
40
|
+
- **`cors()` 不带参数**在不同框架里语义不同(Express 的 `cors()` 确实是允许所有来源),
|
|
41
|
+
但其它框架可能有别的默认值 —— 报出来请确认。
|
|
42
|
+
- **Dockerfile 可能是多阶段的**:`USER root` 出现在构建阶段(builder)通常无害,
|
|
43
|
+
出现在最终阶段才有问题。本工具不区分阶段,需你判断。
|
|
44
|
+
- 与 `dsh-data-scan` / `dsh-cn-pipl-check` 分工:那些查数据,
|
|
45
|
+
这个查**访问数据的权限**。
|
|
46
|
+
|
|
47
|
+
## 五、覆盖面
|
|
48
|
+
|
|
49
|
+
4 项,覆盖容器 / 云策略 / Web / 令牌四类常见的权限过宽。
|