dsh-standards 1.6.2 → 1.6.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.
- package/31-DS-C/346/235/241/346/254/276.md +1428 -0
- package/31-DSH-ENTRY/345/205/245/351/227/250/350/247/204/350/214/203.md +121 -0
- package/34-/344/270/211/345/261/202/345/210/206/347/272/247/346/250/241/345/236/213-GB-GBT-GBZ/347/261/273/346/257/224.md +211 -0
- package/40-checker/fixtures/security/sec15-install-remote-literal/index.js +1 -0
- package/40-checker/fixtures/security/sec15-install-remote-literal/package.json +8 -0
- package/40-checker/fixtures/security/sec15-install-remote-literal/scripts/install.js +6 -0
- package/40-checker/src/author-report.mjs +67 -0
- package/40-checker/src/cli.mjs +2 -1
- package/40-checker/src/report.mjs +80 -9
- package/40-checker/src/security.mjs +36 -9
- package/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/SECURITY.md +135 -0
- package/package.json +4 -1
- package/spec/coverage-contract.md +8 -6
- package/spec/remediation.json +10 -3
- package/spec/schemas/conformance.schema.json +94 -3
|
@@ -383,7 +383,7 @@ const SCRIPT_NETWORK = /\b(?:fetch|axios\.(?:get|post)|https?\.(?:get|request))\
|
|
|
383
383
|
const SCRIPT_EXECUTE = /\beval\b|\bnew\s+Function\b|\b(?:exec|execSync|spawn|spawnSync|execFile|execFileSync)\s*\(|\bvm\.(?:runIn\w+|compileFunction)/
|
|
384
384
|
// require(<variable>) / import(<variable>): loading code that is not a static
|
|
385
385
|
// literal. Only dangerous when the same script also downloads or pipes code.
|
|
386
|
-
const SCRIPT_DYNAMIC_LOAD = /\brequire\s*\(\s*(?!['"`])[A-Za-z_$]|\bimport\s*\(\s*(?!['"`])[A-Za-z_$]/
|
|
386
|
+
const SCRIPT_DYNAMIC_LOAD = /\brequire\s*\(\s*(?!['"`])[A-Za-z_$]|\bimport\s*\(\s*(?!['"`])[A-Za-z_$]|\b(?:require|import)\s*\(\s*['"`](?:\/|\.\.\/|https?:\/\/)/
|
|
387
387
|
const SCRIPT_CHILD_DYNAMIC = [
|
|
388
388
|
/\b(?:exec|execSync|spawn|spawnSync|execFile|execFileSync)\s*\(\s*`[^`]*\$\{/,
|
|
389
389
|
/\b(?:exec|execSync|spawn|spawnSync|execFile|execFileSync)\s*\(\s*[A-Za-z_$][\w$]*\s*[,)]/,
|
|
@@ -663,7 +663,10 @@ export function checkDynamicExecution(manifest, sources, entry, kind = null) {
|
|
|
663
663
|
const command = commandTextOf(node, parsed.bindings)
|
|
664
664
|
const labels = command === null ? [] : dangerousCommandLabels(command)
|
|
665
665
|
if (labels.length > 0) {
|
|
666
|
-
|
|
666
|
+
// Dangerous exec/spawn input is a subprocess finding (C-16.3), not
|
|
667
|
+
// eval/new Function (C-16.1): the remediation for it is "pass an
|
|
668
|
+
// argument array / allowlist", not "remove eval".
|
|
669
|
+
dynamic.push({ file: relative, line: lineOf(node), what: `child_process.${execApi} executes a dangerous command (${labels.join('; ')})`, item: 'C-16.3' })
|
|
667
670
|
return
|
|
668
671
|
}
|
|
669
672
|
}
|
|
@@ -975,6 +978,7 @@ export function checkSensitiveFileReads(manifest, sources) {
|
|
|
975
978
|
const details = []
|
|
976
979
|
const failures = []
|
|
977
980
|
const warnings = []
|
|
981
|
+
const unresolved = []
|
|
978
982
|
let parseErrors = 0
|
|
979
983
|
for (const source of serverSources(sources)) {
|
|
980
984
|
const parsed = parseModule(source)
|
|
@@ -1035,7 +1039,13 @@ export function checkSensitiveFileReads(manifest, sources) {
|
|
|
1035
1039
|
if (!read.homeDerived && !read.secretDerived) {
|
|
1036
1040
|
// A sibling literal alone is weak: only a path-named variable plus a
|
|
1037
1041
|
// credential literal (and egress for FAIL) is actionable.
|
|
1038
|
-
if (!facts.secretLiteral || !read.pathNamed)
|
|
1042
|
+
if (!facts.secretLiteral || !read.pathNamed) {
|
|
1043
|
+
// Fully dynamic argument (function parameter, runtime concat, ...):
|
|
1044
|
+
// nothing can be resolved statically. It is not a PASS with full
|
|
1045
|
+
// coverage; C-17.4 requires partial/not-run plus a reason.
|
|
1046
|
+
unresolved.push({ file: source.relative, line: read.line, api: read.api })
|
|
1047
|
+
continue
|
|
1048
|
+
}
|
|
1039
1049
|
if (facts.egress && facts.secretLiteral === 'strong') {
|
|
1040
1050
|
failures.push({ file: source.relative, line: read.line, api: read.api, reason: `${read.api} reads a path-named variable while the same function contains a credential-like literal and network egress at ${where}` })
|
|
1041
1051
|
} else {
|
|
@@ -1060,12 +1070,22 @@ export function checkSensitiveFileReads(manifest, sources) {
|
|
|
1060
1070
|
for (const item of warnings.slice(0, 8)) {
|
|
1061
1071
|
details.push(detail(item.item ?? 'C-17.2', 'WARN', item.reason, [`${item.file}:${item.line}`]))
|
|
1062
1072
|
}
|
|
1073
|
+
for (const item of unresolved.slice(0, 8)) {
|
|
1074
|
+
const where = `${item.file}:${item.line}`
|
|
1075
|
+
details.push(detail('C-17.4', 'NA', `not-run: dynamic ${item.api} argument at ${where} could not be statically resolved`, [where]))
|
|
1076
|
+
}
|
|
1063
1077
|
if (parseErrors > 0) {
|
|
1064
1078
|
details.push(detail('C-17.3', 'ERROR', `not-run: AST parse failed in ${parseErrors} source file(s)`, []))
|
|
1065
1079
|
}
|
|
1066
|
-
if (failures.length === 0 && warnings.length === 0 && parseErrors === 0) {
|
|
1080
|
+
if (failures.length === 0 && warnings.length === 0 && parseErrors === 0 && unresolved.length === 0) {
|
|
1067
1081
|
details.push(detail('C-17.1', 'PASS', 'no sensitive-file read argument found in the scanned sources'))
|
|
1068
1082
|
}
|
|
1083
|
+
// A fully dynamic read/readdir argument is not a full PASS: the check ran but
|
|
1084
|
+
// could not see the path. Keep the PASS verdict (no clue found) and mark the
|
|
1085
|
+
// coverage partial, with C-17.4 rows naming every unresolved call site.
|
|
1086
|
+
const partialNote = unresolved.length > 0
|
|
1087
|
+
? `partial: ${unresolved.length} read argument(s) are dynamic and could not be statically resolved`
|
|
1088
|
+
: ''
|
|
1069
1089
|
let result
|
|
1070
1090
|
if (failures.length > 0) result = 'FAIL'
|
|
1071
1091
|
else if (parseErrors > 0) result = 'ERROR'
|
|
@@ -1076,12 +1096,14 @@ export function checkSensitiveFileReads(manifest, sources) {
|
|
|
1076
1096
|
clause: 'C-17',
|
|
1077
1097
|
layer: 'L0',
|
|
1078
1098
|
result,
|
|
1079
|
-
coverage: parseErrors > 0 ? 'partial' : 'full',
|
|
1099
|
+
coverage: parseErrors > 0 || unresolved.length > 0 ? 'partial' : 'full',
|
|
1080
1100
|
reason: failures.length > 0
|
|
1081
|
-
? `${failures.length} sensitive-file read(s) in API arguments`
|
|
1101
|
+
? `${failures.length} sensitive-file read(s) in API arguments${partialNote ? `; ${partialNote}` : ''}`
|
|
1082
1102
|
: parseErrors > 0
|
|
1083
1103
|
? `AST parse failed in ${parseErrors} file(s); DSC-17 partial`
|
|
1084
|
-
: warnings.length > 0
|
|
1104
|
+
: warnings.length > 0
|
|
1105
|
+
? `${warnings.length} dotenv/environment clue(s)${partialNote ? `; ${partialNote}` : ''}`
|
|
1106
|
+
: partialNote,
|
|
1085
1107
|
details,
|
|
1086
1108
|
evidence: failures.slice(0, 5).map(item => `${item.file}:${item.line}`),
|
|
1087
1109
|
})
|
|
@@ -1459,8 +1481,11 @@ function scopeOf(name) {
|
|
|
1459
1481
|
}
|
|
1460
1482
|
|
|
1461
1483
|
export function checkSupplyChain(manifest) {
|
|
1484
|
+
// devDependencies are scanned as well: a near-miss name there still installs
|
|
1485
|
+
// code into the author's machine and is what DS-C §C-21 asks about.
|
|
1462
1486
|
const dependencies = {
|
|
1463
1487
|
...(manifest?.dependencies && typeof manifest.dependencies === 'object' ? manifest.dependencies : {}),
|
|
1488
|
+
...(manifest?.devDependencies && typeof manifest.devDependencies === 'object' ? manifest.devDependencies : {}),
|
|
1464
1489
|
...(manifest?.optionalDependencies && typeof manifest.optionalDependencies === 'object' ? manifest.optionalDependencies : {}),
|
|
1465
1490
|
...(manifest?.peerDependencies && typeof manifest.peerDependencies === 'object' ? manifest.peerDependencies : {}),
|
|
1466
1491
|
}
|
|
@@ -1484,13 +1509,15 @@ export function checkSupplyChain(manifest) {
|
|
|
1484
1509
|
details.push(detail(finding.item, 'WARN', finding.why, [`package.json#dependencies.${finding.name}`]))
|
|
1485
1510
|
}
|
|
1486
1511
|
if (names.length === 0) {
|
|
1487
|
-
details.push(detail('C-21.1', 'PASS', 'no
|
|
1512
|
+
details.push(detail('C-21.1', 'PASS', 'no dependencies declared (dependencies/devDependencies/optional/peer)'))
|
|
1488
1513
|
return check({
|
|
1489
1514
|
id: 'DSC-21', clause: 'C-21', layer: 'L0', result: 'PASS', coverage: 'full', advisory: false,
|
|
1490
1515
|
reason: '', details, evidence: ['package.json#dependencies'],
|
|
1491
1516
|
})
|
|
1492
1517
|
}
|
|
1493
|
-
|
|
1518
|
+
const nameList = names.slice(0, 20).join(', ')
|
|
1519
|
+
const more = names.length > 20 ? ` (+${names.length - 20} more)` : ''
|
|
1520
|
+
details.push(detail('C-21.3', 'NA', `not-run: dependency install scripts and transitive registry metadata need registry data; declared dependencies: ${nameList}${more}; a missing lockfile is not treated as a defect`, []))
|
|
1494
1521
|
if (findings.length === 0) {
|
|
1495
1522
|
details.push(detail('C-21.1', 'PASS', `${names.length} dependency name(s) checked; ${knownCount} exact known name(s)`))
|
|
1496
1523
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 1.6.4 — 2026-11-07
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- `security.status` semantics: `pass` only when all eight checks are PASS and fully covered; WARN/partial → `warn`, NA/ERROR/not-run → `incomplete`, 15/16/17 FAIL → `fail`; new `security.partial[]`.
|
|
6
|
+
- `--scope security` no longer reports DSC-02 as blocking; `conclusion.status`, `headline` and `buckets.blocking` now agree.
|
|
7
|
+
- C-16 subprocess findings use C-16.3 with the right fix; advice gates never promote a WARN detail to FAIL.
|
|
8
|
+
- C-17 dynamic reads become `PASS/partial` (not full PASS); C-21 scans `devDependencies` and lists dependency names; C-21 stays WARN-only.
|
|
9
|
+
- `SECURITY.md`, `31-*`, `34-*` now ship in the npm package; README version is 1.6.x; conformance schema accepts `safety`, host-version fields and `security.partial`.
|
|
10
|
+
- Author Markdown/HTML render a `## Security (scope)` section (was invisible to `check` users); coverage contract updated.
|
|
11
|
+
|
|
12
|
+
### Verified
|
|
13
|
+
|
|
14
|
+
- `npm test` 299/299; 50 historical reports + 20 regenerated pass the schema; malicious samples still fail under security scope.
|
|
15
|
+
## 1.6.3 — 2026-11-07
|
|
16
|
+
|
|
17
|
+
- DSC-15: an install script that downloads code and then loads a literal path outside the package (`require('/tmp/...')`, URL, `../`) now FAILs; the variable form was already covered.
|
|
18
|
+
|
|
1
19
|
## 1.6.2 — 2026-11-07
|
|
2
20
|
|
|
3
21
|
### Fixed
|
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ DSH 插件的采用深度分三层,每层一个问题、一套证据状态,*
|
|
|
44
44
|
|
|
45
45
|
仓里就三样东西:`40-checker/`(DS-C 一致性检查器与全部证据脚本)、`bin/`(两个公开入口 `dsh-standards` 与 `dsh-levels`),以及 `spec/` 与 `31`–`35` 号规范正文。工具只读目标包,不改被检对象;结论只认证据,`not-run`、`NA`、`static` 都不会被写成 PASS。
|
|
46
46
|
|
|
47
|
-
npm 上的旧占位 `dsh-standards@0.0.3` 只是名字预留,这条 1.x 线取代了它(当前 `1.
|
|
47
|
+
npm 上的旧占位 `dsh-standards@0.0.3` 只是名字预留,这条 1.x 线取代了它(当前 `1.6.x`);两个 bin 分别叫 `dsh-standards` 与 `dsh-levels`。
|
|
48
48
|
|
|
49
49
|
锚点不是硬编码的通行证:`repo` / `commit` / `cordis` 记在报告里,`dsh` 由 `--host-version`、`DSH_HOST_VERSION` 或显式 `--allow-host-probe` 解析;都没有时报告写「host 版本未知」,并标 `source=default, suspect=true`。换一次版本就是另一把尺子,旧报告不能直接当新版本的证据。
|
|
50
50
|
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
> 本仓库是**非官方**的 DSH 插件标准与检查器,不是安全审计、认证、背书或担保。
|
|
4
|
+
> This repository is a non-official draft standard and a checker. It is **not** a
|
|
5
|
+
> security audit, certification, endorsement, or warranty for any plugin.
|
|
6
|
+
|
|
7
|
+
## Supported versions
|
|
8
|
+
|
|
9
|
+
Security fixes target the latest published minor line. Older lines may receive
|
|
10
|
+
best-effort fixes only when the fix is small and the reporter is affected.
|
|
11
|
+
|
|
12
|
+
| Version | Supported | Notes |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| `1.6.x` (current) | **Yes** | Security fixes and checker-rule corrections. |
|
|
15
|
+
| `1.5.x` | Best effort | Upgrade recommended; no new features. |
|
|
16
|
+
| `1.4.x` | Best effort | Upgrade recommended; no new features. |
|
|
17
|
+
| `<= 1.3` | No | Please reproduce on `1.6.x` before reporting. |
|
|
18
|
+
|
|
19
|
+
The table describes **targets**, not a service-level agreement. This project has
|
|
20
|
+
a bus factor of 1 (see [`CONTINUITY.md`](CONTINUITY.md)); response may be slower
|
|
21
|
+
during absences. There is no bug bounty.
|
|
22
|
+
|
|
23
|
+
## What to report
|
|
24
|
+
|
|
25
|
+
In scope:
|
|
26
|
+
|
|
27
|
+
- a checker rule that can be **bypassed** to mark an unsafe or non-conforming
|
|
28
|
+
plugin as `PASS` (false negative), or a rule that fails a benign package
|
|
29
|
+
predictably (false positive with a minimal repro);
|
|
30
|
+
- a false negative that lets a plugin with a known-dangerous trigger
|
|
31
|
+
(`credentials:*`, `network:egress`, shell/exec, filesystem writes outside the
|
|
32
|
+
workspace) pass ENTRY/DS-C without a label or a `not-run` record;
|
|
33
|
+
- a vulnerability in the checker's own code, its sandbox/runner, or its CI
|
|
34
|
+
workflows (including a leaked CI secret);
|
|
35
|
+
- a leaked credential, token, private key, or `.env` value in this repository,
|
|
36
|
+
its commits, issues, releases, or npm tarballs;
|
|
37
|
+
- a documentation claim that overstates what a check proves (for example calling
|
|
38
|
+
a `PASS` a "security audit" or "certified safe");
|
|
39
|
+
- a supply-chain problem in this repository's own dependencies or release
|
|
40
|
+
process.
|
|
41
|
+
|
|
42
|
+
Out of scope:
|
|
43
|
+
|
|
44
|
+
- vulnerabilities in **third-party plugins**. Report those to the plugin author
|
|
45
|
+
and, for malicious npm packages, to npm support. This project is not a CVE
|
|
46
|
+
authority and cannot coordinate disclosure for third-party code;
|
|
47
|
+
- general support, feature requests, or "is this plugin safe?" reviews;
|
|
48
|
+
- a plugin merely being listed or checked here. Listing is not endorsement.
|
|
49
|
+
|
|
50
|
+
## How to report
|
|
51
|
+
|
|
52
|
+
**Preferred:** open a private GitHub Security Advisory at
|
|
53
|
+
<https://github.com/PerryLink/dsh-standards/security/advisories/new>.
|
|
54
|
+
If private advisories are unavailable, contact the maintainer listed in
|
|
55
|
+
[`MAINTAINERS.md`](MAINTAINERS.md) through the contact method on their GitHub
|
|
56
|
+
profile. Do **not** open a public issue for a security report.
|
|
57
|
+
|
|
58
|
+
**Do not put any of the following in a public issue, discussion, PR, or social
|
|
59
|
+
post:**
|
|
60
|
+
|
|
61
|
+
- a working exploit, bypass, payload, or step-by-step reproduction against an
|
|
62
|
+
unpatched version;
|
|
63
|
+
- credentials, tokens, API keys, cookies, private keys, `.env` contents, or
|
|
64
|
+
`$DSH_HOME`/`~/.dsh` file contents;
|
|
65
|
+
- personal data, session transcripts, private filesystem paths, or third-party
|
|
66
|
+
user content;
|
|
67
|
+
- a malicious plugin tarball or a link that executes one;
|
|
68
|
+
- CVE/embargo details before a coordinated disclosure date.
|
|
69
|
+
|
|
70
|
+
If you already posted sensitive material publicly, say so in the private report
|
|
71
|
+
and rotate/revoke the exposed secret first; deleting the post is not enough.
|
|
72
|
+
|
|
73
|
+
## What to include
|
|
74
|
+
|
|
75
|
+
A useful report has:
|
|
76
|
+
|
|
77
|
+
1. affected project version (`dsh-standards --version`) and commit/tag;
|
|
78
|
+
2. DSH host version and Cordis version, if the issue involves runtime behavior;
|
|
79
|
+
3. OS and Node version;
|
|
80
|
+
4. the affected clause/check ID (`C-15`, `DSC-17`, …) and the expected vs actual
|
|
81
|
+
result;
|
|
82
|
+
5. impact: what an attacker gains, or what a user is misled to believe;
|
|
83
|
+
6. a minimal repro (sanitized): package manifest, fixture, command, and the
|
|
84
|
+
relevant report JSON;
|
|
85
|
+
7. whether the issue is already public or known to others;
|
|
86
|
+
8. preferred credit name, or "anonymous".
|
|
87
|
+
|
|
88
|
+
Reports that contain secrets should redact them; we do not need the real value to
|
|
89
|
+
fix a leak.
|
|
90
|
+
|
|
91
|
+
## Response targets (not commitments)
|
|
92
|
+
|
|
93
|
+
| Stage | Target |
|
|
94
|
+
|---|---|
|
|
95
|
+
| Acknowledge receipt | within 7 calendar days |
|
|
96
|
+
| Initial triage + severity | within 14 calendar days |
|
|
97
|
+
| Fix or documented mitigation | within 90 calendar days |
|
|
98
|
+
| Coordinated disclosure | default 90 days after triage, by mutual agreement |
|
|
99
|
+
|
|
100
|
+
These are **targets**, not guarantees. If a fix needs a host change or a
|
|
101
|
+
third-party release, we will say so and may ask for more time. If the issue is
|
|
102
|
+
being actively exploited, we may publish a mitigation before a full fix.
|
|
103
|
+
|
|
104
|
+
## Disclosure and credit
|
|
105
|
+
|
|
106
|
+
- We follow coordinated disclosure: private report → fix → advisory → public
|
|
107
|
+
details. We will credit the reporter unless they ask to remain anonymous.
|
|
108
|
+
- We may request a CVE through GitHub's advisory flow when the issue affects
|
|
109
|
+
users broadly. We cannot assign CVEs for third-party plugins.
|
|
110
|
+
- We do not pay bounties. We do not sign NDAs or provide legal advice.
|
|
111
|
+
- Please do not test against other people's machines, accounts, or data; use
|
|
112
|
+
your own temporary profile and a fake `DSH_HOME`/`HOME` (see the audit
|
|
113
|
+
fixtures in the repository for the expected pattern).
|
|
114
|
+
|
|
115
|
+
## What a PASS means (scope boundary)
|
|
116
|
+
|
|
117
|
+
- `DS-C`, `DSH-ENTRY`, `DSH-FLOW`, `DSH-BOOST`, and `--scope security` are
|
|
118
|
+
**evidence checks at a recorded anchor**, not a security review.
|
|
119
|
+
- In `--scope security`, `security.status=pass` only means: within the 8
|
|
120
|
+
security checks (`C-15`–`C-22`), no blocking check produced FAIL and no
|
|
121
|
+
mandatory check was left `NA`/`ERROR`/`not-run`; there was also no WARN.
|
|
122
|
+
Outside that scope the block is advisory only (FAIL is capped to WARN and does
|
|
123
|
+
not enter `buckets.blocking`), so `pass` there does not assert coverage.
|
|
124
|
+
`C-18`/`C-19`/`C-20`/`C-22` are advisory and never produce FAIL (their WARN can
|
|
125
|
+
make the status `warn`, not `fail`). `C-21` is mandatory in `--scope security`
|
|
126
|
+
but its findings are **WARN-only and never block, in the listing profile
|
|
127
|
+
too**; a check-level `not-run` can make the status `incomplete`.
|
|
128
|
+
- A plugin is code that runs in the host process with the user's privileges.
|
|
129
|
+
Static checks cannot prove the absence of malice: dynamic code loading,
|
|
130
|
+
runtime URL construction, `readdir` + prefix matching, transitive dependency
|
|
131
|
+
scripts, and prompt injection semantics are outside static reach.
|
|
132
|
+
- A `PASS` without a command, version, and artifact is a bug. Report it.
|
|
133
|
+
- Plugin authors remain responsible for their own code and disclosures. A
|
|
134
|
+
"recognized" or "passing" result does not mean the plugin is secure, correct,
|
|
135
|
+
or endorsed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-standards",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "DSH plugin standards and conformance checks: ENTRY/FLOW checks plus BOOST guidance. Non-official; no certification or ranking.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "40-checker/src/index.mjs",
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
"spec",
|
|
26
26
|
"docs",
|
|
27
27
|
"README.md",
|
|
28
|
+
"SECURITY.md",
|
|
29
|
+
"31-*.md",
|
|
30
|
+
"34-*.md",
|
|
28
31
|
"CHANGELOG.md",
|
|
29
32
|
"LICENSE",
|
|
30
33
|
"LICENSE-APACHE",
|
|
@@ -105,15 +105,17 @@
|
|
|
105
105
|
| 项 | 语义 |
|
|
106
106
|
|---|---|
|
|
107
107
|
| 计入 `total` | **默认否**:`checks[]` 仍是 14,`security` 块单独存在、不计入 `coverage`。**security 是**:`checks[]` 22,`coverage.total=22`、`coverage.mandatory=4`。 |
|
|
108
|
-
| 默认 `security.scope` | `"advisory"`。8 项照常评估,但任何 `FAIL` 封顶为 `WARN`,不改 `conclusion`/exit;`security.status` 可为 `pass`/`warn
|
|
109
|
-
| `security.status=pass` | **
|
|
110
|
-
| `security.status=fail` | **仅 security scope**:`DSC-15`/`DSC-16`/`DSC-17` 任一 FAIL
|
|
111
|
-
| `security.status=warn` | 无 FAIL
|
|
112
|
-
| `security.status=incomplete` |
|
|
113
|
-
| `security
|
|
108
|
+
| 默认 `security.scope` | `"advisory"`。8 项照常评估,但任何 `FAIL` 封顶为 `WARN`,不改 `conclusion`/exit;`security.status` 可为 `pass`/`warn`/`incomplete`(`FAIL` 被封顶成 `WARN` 后不会出现 `fail`)。 |
|
|
109
|
+
| `security.status=pass` | 仅当 **8 项全部** `PASS` 且每项 `coverage=full`(即 `blocking`/`warn`/`advisory`/`partial`/`notRun` 全空)。任一 `WARN`(含 advisory)、`partial`、`NA`/`ERROR`/`not-run` 或缺失项都**不得**记 `pass`;`pass` 只覆盖这 8 项的静态/元数据证据,不是覆盖完整或安全证明。C-21 的传递依赖元数据缺失只记 check 级 `coverage: partial`,因此也不等同 PASS。 |
|
|
110
|
+
| `security.status=fail` | **仅 security scope**:`DSC-15`/`DSC-16`/`DSC-17` 任一 FAIL;优先于 `warn`/`incomplete`。`DSC-21` 永不 FAIL;默认 advisory 模式 FAIL 封顶 WARN,不会出现 `fail`。 |
|
|
111
|
+
| `security.status=warn` | 无 blocking FAIL、无 `NA`/`ERROR`/完整 `not-run`,但存在任一 `WARN`(含 `DSC-21` 或 15/16/17 的 WARN、18/19/20/22 的 advisory WARN)或 `coverage=partial`。 |
|
|
112
|
+
| `security.status=incomplete` | 8 项中任一结果为 `NA`/`ERROR`/`not-run`,或 8 项有缺失(未产出 `PASS`/`WARN`/`FAIL`);先于 `warn` 判定,但已有 blocking FAIL 时仍是 `fail`。 |
|
|
113
|
+
| `security.partial[]` | 1.6.x 起为对象数组 `{ "id": "DSC-16", "reason": "..." }`:收 `checks[].coverage === "partial"` 的 security 项,`reason` 取该检查行(或失败 detail)的理由;**不并入** `security.notRun[]`(`notRun` 只收 `NA`/`ERROR`/完整 `not-run`),但**会阻止 `security.status=pass`**。顶层 `coverage.partial` / `buckets.partial` 在 security scope 下统计 `checks[]` 全部 22 项(含这 8 项)。 |
|
|
114
114
|
| 与 DS-C 关系 | **独立**:security FAIL 不撤销 DS-C PASS;DS-C PASS 不证明 security 通过;反之亦然。 |
|
|
115
115
|
| 徽章 | **不得**发 security 徽章;市场只透传 `security.status`、`security.checks[]` 与 `security.notRun[]`,不按安全分排序/筛选。 |
|
|
116
116
|
|
|
117
|
+
判定优先级:`fail` > `incomplete` > `warn` > `pass`(与 `buildSecurityView()` 一致);同一项同时满足多个条件时取最高。
|
|
118
|
+
|
|
117
119
|
严重度以 `spec/dsc-clauses.json` 的 `mandatory`/`advisory` 与 31 §2 C-15~C-22 为准:`DSC-15/16/17` 为 blocking(可 FAIL);`DSC-21` 是强制项但 **WARN-only、不阻断(listing 同;永不 FAIL,未跑才 `incomplete`)**;`DSC-18/19/20/22` 为 advisory(`advisory:true`,永不改 verdict)。`security` 块只汇总这 8 项,不与顶层 `coverage` 换算成第二套通过率。
|
|
118
120
|
|
|
119
121
|
## 7. 禁止事项
|
package/spec/remediation.json
CHANGED
|
@@ -525,9 +525,9 @@
|
|
|
525
525
|
"severityHint": "fail"
|
|
526
526
|
},
|
|
527
527
|
"C-16.3": {
|
|
528
|
-
"title": "child_process
|
|
529
|
-
"why": "子进程可执行任意命令并绕过进程内 seam
|
|
530
|
-
"fix": "
|
|
528
|
+
"title": "child_process 不得拼接外部输入,且需声明子进程能力",
|
|
529
|
+
"why": "子进程可执行任意命令并绕过进程内 seam;把用户/外部输入拼进 exec/spawn 会让命令注入直接变成代码执行。",
|
|
530
|
+
"fix": "不要把用户/外部输入拼进 exec/spawn;用参数数组(execFile/spawn 的 argv)并做命令/参数白名单。确需子进程时声明 subprocess 能力,并在评审中说明命令与输入边界。",
|
|
531
531
|
"docs": "docs/security.md#4-files-subprocesses-and-dynamic-execution-dsc-15-dsc-16-dsc-17-dsc-19",
|
|
532
532
|
"severityHint": "warn"
|
|
533
533
|
},
|
|
@@ -566,6 +566,13 @@
|
|
|
566
566
|
"docs": "docs/security.md#2-credentials-and-sensitive-files-dsc-17",
|
|
567
567
|
"severityHint": "warn"
|
|
568
568
|
},
|
|
569
|
+
"C-17.4": {
|
|
570
|
+
"title": "完全动态的读取实参使检查不完整",
|
|
571
|
+
"why": "运行时拼接/编码/子进程读出的路径无法静态回溯;把它当 full PASS 会高估覆盖。",
|
|
572
|
+
"fix": "把读取路径在调用点显式化(字面量或可静态折叠的常量);确实无法解析时接受 partial/not-run,不要声称该读取已检查。",
|
|
573
|
+
"docs": "docs/security.md#2-credentials-and-sensitive-files-dsc-17",
|
|
574
|
+
"severityHint": "warn"
|
|
575
|
+
},
|
|
569
576
|
"C-18": {
|
|
570
577
|
"title": "外联端点应可披露",
|
|
571
578
|
"why": "端点本身不判恶意,但非 https、webhook/paste/ngrok/onion、公网裸 IP 与未披露端点值得人工复核。",
|
|
@@ -80,6 +80,9 @@
|
|
|
80
80
|
"additionalProperties": true,
|
|
81
81
|
"description": "Additive block for explicit runtime runs (dsh-runtime-checks/1): executed, modes, durationMs, isolation, reason, failure, checks, entry."
|
|
82
82
|
},
|
|
83
|
+
"safety": {
|
|
84
|
+
"$ref": "#/$defs/safety"
|
|
85
|
+
},
|
|
83
86
|
"security": {
|
|
84
87
|
"$ref": "#/$defs/security"
|
|
85
88
|
}
|
|
@@ -247,8 +250,10 @@
|
|
|
247
250
|
"enum": [
|
|
248
251
|
"cli",
|
|
249
252
|
"host",
|
|
250
|
-
"fallback"
|
|
251
|
-
|
|
253
|
+
"fallback",
|
|
254
|
+
"default"
|
|
255
|
+
],
|
|
256
|
+
"description": "default is emitted by the author-facing `check --json` path when no host version is known."
|
|
252
257
|
},
|
|
253
258
|
"hostVersion": {
|
|
254
259
|
"oneOf": [
|
|
@@ -263,6 +268,19 @@
|
|
|
263
268
|
},
|
|
264
269
|
"suspect": {
|
|
265
270
|
"type": "boolean"
|
|
271
|
+
},
|
|
272
|
+
"hostVersionKnown": {
|
|
273
|
+
"type": "boolean",
|
|
274
|
+
"description": "Additive: emitted by the author-facing `check --json` path. Raw checker reports omit it."
|
|
275
|
+
},
|
|
276
|
+
"hostVersionSource": {
|
|
277
|
+
"enum": [
|
|
278
|
+
"flag",
|
|
279
|
+
"env",
|
|
280
|
+
"probe",
|
|
281
|
+
"none"
|
|
282
|
+
],
|
|
283
|
+
"description": "Additive: where the host version came from on the author-facing path."
|
|
266
284
|
}
|
|
267
285
|
}
|
|
268
286
|
},
|
|
@@ -861,7 +879,7 @@
|
|
|
861
879
|
"security": {
|
|
862
880
|
"type": "object",
|
|
863
881
|
"additionalProperties": false,
|
|
864
|
-
"description": "Additive security view (DSC-15..DSC-22). In --scope security the checks keep their real verdict and DSC-15/16/17
|
|
882
|
+
"description": "Additive security view (DSC-15..DSC-22). In --scope security the checks keep their real verdict and DSC-15/16/17 are blocking (DSC-21 is mandatory but WARN-only); in every other scope a FAIL is capped to WARN. status=pass only when all eight checks are PASS with full coverage; partial[] lists the partly checked ones with reasons. This block never changes the default verdict and never proves the absence of malicious code.",
|
|
865
883
|
"required": [
|
|
866
884
|
"scope",
|
|
867
885
|
"status",
|
|
@@ -919,6 +937,79 @@
|
|
|
919
937
|
"type": "string"
|
|
920
938
|
},
|
|
921
939
|
"description": "Check ids that are NA, ERROR, or coverage=not-run."
|
|
940
|
+
},
|
|
941
|
+
"partial": {
|
|
942
|
+
"type": "array",
|
|
943
|
+
"description": "Additive (1.6.x+): checks with coverage=partial, each with its reason. Optional so reports produced before it still validate.",
|
|
944
|
+
"items": {
|
|
945
|
+
"type": "object",
|
|
946
|
+
"additionalProperties": false,
|
|
947
|
+
"required": [
|
|
948
|
+
"id",
|
|
949
|
+
"reason"
|
|
950
|
+
],
|
|
951
|
+
"properties": {
|
|
952
|
+
"id": {
|
|
953
|
+
"type": "string",
|
|
954
|
+
"minLength": 1
|
|
955
|
+
},
|
|
956
|
+
"reason": {
|
|
957
|
+
"type": "string"
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
"safety": {
|
|
965
|
+
"type": "object",
|
|
966
|
+
"additionalProperties": false,
|
|
967
|
+
"description": "Additive safety/provenance block emitted by the author-facing `check --json` path (`dsh-standards check`). Raw checker reports omit it; it records whether plugin code was executed and where the host version came from.",
|
|
968
|
+
"required": [
|
|
969
|
+
"executed",
|
|
970
|
+
"defaultSafety",
|
|
971
|
+
"entryClaim",
|
|
972
|
+
"noExec",
|
|
973
|
+
"hostVersionKnown",
|
|
974
|
+
"hostVersionSource",
|
|
975
|
+
"hostProbeAllowed",
|
|
976
|
+
"runtimeVersionExplicit"
|
|
977
|
+
],
|
|
978
|
+
"properties": {
|
|
979
|
+
"executed": {
|
|
980
|
+
"type": "boolean"
|
|
981
|
+
},
|
|
982
|
+
"defaultSafety": {
|
|
983
|
+
"type": "boolean"
|
|
984
|
+
},
|
|
985
|
+
"entryClaim": {
|
|
986
|
+
"enum": [
|
|
987
|
+
"runtime",
|
|
988
|
+
"static"
|
|
989
|
+
]
|
|
990
|
+
},
|
|
991
|
+
"noExec": {
|
|
992
|
+
"type": "boolean"
|
|
993
|
+
},
|
|
994
|
+
"hostVersionKnown": {
|
|
995
|
+
"type": "boolean"
|
|
996
|
+
},
|
|
997
|
+
"hostVersionSource": {
|
|
998
|
+
"enum": [
|
|
999
|
+
"flag",
|
|
1000
|
+
"env",
|
|
1001
|
+
"probe",
|
|
1002
|
+
"none"
|
|
1003
|
+
]
|
|
1004
|
+
},
|
|
1005
|
+
"hostProbeAllowed": {
|
|
1006
|
+
"type": "boolean"
|
|
1007
|
+
},
|
|
1008
|
+
"runtimeVersionExplicit": {
|
|
1009
|
+
"type": "boolean"
|
|
1010
|
+
},
|
|
1011
|
+
"hostVersionError": {
|
|
1012
|
+
"type": "string"
|
|
922
1013
|
}
|
|
923
1014
|
}
|
|
924
1015
|
}
|