dsh-standards 1.6.5 → 1.6.7
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 +7 -5
- package/40-checker/fixtures/security/sec16-vendor-bundle/lib/index.js +16 -0
- package/40-checker/fixtures/security/sec16-vendor-bundle/package.json +22 -0
- package/40-checker/fixtures/security/sec16-vendor-decoy/lib/index.js +5 -0
- package/40-checker/fixtures/security/sec16-vendor-decoy/package.json +22 -0
- package/40-checker/fixtures/security/sec16-vendor-path/index.mjs +1 -0
- package/40-checker/fixtures/security/sec16-vendor-path/package.json +19 -0
- package/40-checker/fixtures/security/sec16-vendor-path/vendor/schemastery.mjs +4 -0
- package/40-checker/scripts/build-sidecar.mjs +96 -3
- package/40-checker/scripts/flow-collect.mjs +26 -8
- package/40-checker/src/author-cli.mjs +10 -1
- package/40-checker/src/cli.mjs +100 -9
- package/40-checker/src/manifest.mjs +180 -51
- package/40-checker/src/security.mjs +201 -15
- package/CHANGELOG.md +28 -0
- package/docs/coverage.md +1 -1
- package/package.json +1 -1
- package/spec/coverage-contract.md +1 -1
- package/spec/dsc-clauses.json +1 -1
- package/spec/remediation.json +1 -1
- package/spec/schemas/conformance.schema.json +4 -0
|
@@ -875,15 +875,15 @@ export function apply(ctx: Context) {
|
|
|
875
875
|
|
|
876
876
|
### C-16 动态执行
|
|
877
877
|
|
|
878
|
-
> **判定**:**blocking**(仅 `--scope security`)。动态执行默认不可审计;本项没有"声明后放行"
|
|
878
|
+
> **判定**:**blocking**(仅 `--scope security`)。动态执行默认不可审计;本项没有"声明后放行"的例外,非 vendor 命中即 FAIL;1.6.6 起 vendor 文件内的 `eval`/`new Function` 仅降为 WARN(不是 PASS,可用 `--strict-vendor` 恢复 FAIL)。
|
|
879
879
|
|
|
880
880
|
**要求(祈使句)**:服务端入口闭包不得使用 `eval`、`new Function`(空参探针除外)、`vm.runIn*`/`vm.Script`/`vm.createContext`、`module._compile`、`process.binding`;不得直接 `require`/`import` `child_process` 绕过 `ctx.subprocess`。
|
|
881
881
|
|
|
882
|
-
**判定方式**:L0 静态(DSC-16)。只扫服务端入口及其**本地相对 import 闭包**;`lib/client.js`/浏览器 bundle 不扫(避免把打包器探针当插件行为);`new Function("")` / `new Function()` 空参探针豁免。1.6.1 对裸 `child_process` 只 WARN;1.6.2 起对静态可判为下载后执行/解码执行的危险命令升级 FAIL。
|
|
882
|
+
**判定方式**:L0 静态(DSC-16)。只扫服务端入口及其**本地相对 import 闭包**;`lib/client.js`/浏览器 bundle 不扫(避免把打包器探针当插件行为);`new Function("")` / `new Function()` 空参探针豁免。1.6.1 对裸 `child_process` 只 WARN;1.6.2 起对静态可判为下载后执行/解码执行的危险命令升级 FAIL;1.6.6 起 vendor/第三方文件内的 `eval`/`new Function` 降为 WARN(detail 记 `C-16.1` + `vendor: true` + 理由),默认可用 `--strict-vendor`(别名 `--no-vendor-exempt`)恢复 FAIL。
|
|
883
883
|
|
|
884
884
|
| 子项 | 检查 | 结果 |
|
|
885
885
|
|---|---|---|
|
|
886
|
-
| C-16.1 | 闭包内 `eval`、`new Function(非空)`、`module._compile`、`process.binding`;1.6.2
|
|
886
|
+
| C-16.1 | 闭包内 `eval`、`new Function(非空)`、`module._compile`、`process.binding`;1.6.2 起含静态可判的危险子进程命令(下载后执行/解码执行);1.6.6 起 vendor 文件内的 `eval`/`new Function` 单独降级 | 非 vendor → FAIL;vendor → WARN(`vendor: true`;`--strict-vendor` 恢复 FAIL) |
|
|
887
887
|
| C-16.2 | 闭包内 `vm.runIn*`、`vm.Script`、`vm.createContext` | 命中 → FAIL |
|
|
888
888
|
| C-16.3 | 闭包内 `require('child_process')` / `import('node:child_process')` 等裸子进程入口;空参 `new Function("")`/`lib/client.js` 豁免 | 裸入口 → WARN(1.6.1 危险子进程命令也只 WARN;1.6.2 起改判 C-16.1 FAIL);空参/client → 不计负 |
|
|
889
889
|
| C-16.4 | 字符串拼接 `import()`、`Function(atob(...))`、运行时从远程取代码;package import/解析失败 | 静态不可判 → `not-run`/`partial`,不冒充 PASS |
|
|
@@ -893,12 +893,14 @@ export function apply(ctx: Context) {
|
|
|
893
893
|
| 值 | 条件 |
|
|
894
894
|
|---|---|
|
|
895
895
|
| PASS | C-16.1/C-16.2/C-16.3 均无命中;C-16.4 的 package import/unresolved 只写 `coverage: partial`,不改 PASS |
|
|
896
|
-
| WARN | 仅 C-16.3 命中(裸 `child_process
|
|
897
|
-
| FAIL | C-16.1 或 C-16.2
|
|
896
|
+
| WARN | 仅 C-16.3 命中(裸 `child_process`);或仅 vendor 文件内的 C-16.1 命中(不进入 `security.blocking`;`--strict-vendor` 下仍 FAIL) |
|
|
897
|
+
| FAIL | 非 vendor 文件的 C-16.1 或 C-16.2 任一命中;或任意文件的 base64 混淆执行(vendor 也不豁免) |
|
|
898
898
|
| NA | 没有可扫描的源文件;或 `dsh.kind` 非 plugin/bundle |
|
|
899
899
|
|
|
900
900
|
**误报与抑制**:打包进 bundle 的 ajv 会用 `new Function("")` 探 `allowsEval`(`dsh-budget/lib/client.js`、`dsh-library/lib/index.js`),空参豁免;浏览器 bundle 不扫。Babel/TS 解析失败记 `ERROR`/`not-run`,不判 PASS;AST 只认真实调用,不把 `typeof eval` 当执行。
|
|
901
901
|
|
|
902
|
+
**vendor/第三方源码(1.6.6,`DSC-16` 专用)**:只有 `eval()` / `new Function()` 可降级,且文件须满足下列之一:路径含 `node_modules/`、`vendor/`、`third_party/`、`deps/`;有打包器 `//#region node_modules/...` 区间(按命中行所在区间判定库名);有 `schemastery`/`ajv`/`lodash` 库指纹或库形文件名;或同目录(`src/` 外)有上述强证据。`package.json` 的 `dependencies`/`devDependencies` 含该库只作佐证,**单独不足以豁免**(防止以声明依赖换取 `eval` 放行)。`vm.*`、`module._compile`、`process.binding`、危险子进程命令、base64+eval 一律不豁免;降级结果为 WARN(永不 PASS),`--strict-vendor` 恢复 FAIL。该识别是启发式、可伪造,不构成"第三方代码安全"的证明。
|
|
903
|
+
|
|
902
904
|
**与 DSC 的对应**:`DSC-16`。扩展 `C-11.2` 触发表:C-11.2 只认 `ctx.*`、裸 `fetch` 等文本,不认 `eval`/`vm`/node 内置模块;C-10.4 只覆盖 import 期 fs/子进程,不覆盖 eval。动态执行没有声明放行(checker 不读取 `code:dynamic` 之类的字段)。
|
|
903
905
|
|
|
904
906
|
**边界说明**:动态执行的判定高度依赖静态形态;`globalThis['ev'+'al']`、`require('vm')`、WebAssembly、远程代码加载都可绕过。PASS 不是"没有动态执行",只是"本次闭包内没有可见形态"。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// A bundle that inlines a declared dependency the way esbuild/rolldown does.
|
|
2
|
+
// The schemastery parser compiles a *declared callback string*, not a payload.
|
|
3
|
+
//#region node_modules/.pnpm/@deepseek-ai+schemastery@3.19.0/node_modules/@deepseek-ai/schemastery/lib/index.js
|
|
4
|
+
const kSchema = Symbol.for("schemastery")
|
|
5
|
+
|
|
6
|
+
export function apply(schema) {
|
|
7
|
+
if (typeof schema.callback === "string") {
|
|
8
|
+
schema.callback = new Function("return " + schema.callback)()
|
|
9
|
+
}
|
|
10
|
+
return { schema, kSchema }
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
|
|
14
|
+
export function register(ctx) {
|
|
15
|
+
ctx?.plugin?.(apply)
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-fixtures/sec16-vendor-bundle",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@deepseek-ai/schemastery": "~3.19.0"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"dsh": ">=0.2.2-alpha.2 <0.3.0"
|
|
15
|
+
},
|
|
16
|
+
"dsh": {
|
|
17
|
+
"manifestVersion": 1,
|
|
18
|
+
"kind": "plugin",
|
|
19
|
+
"capabilities": [],
|
|
20
|
+
"labels": []
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-fixtures/sec16-vendor-decoy",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@deepseek-ai/schemastery": "~3.19.0"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"dsh": ">=0.2.2-alpha.2 <0.3.0"
|
|
15
|
+
},
|
|
16
|
+
"dsh": {
|
|
17
|
+
"manifestVersion": 1,
|
|
18
|
+
"kind": "plugin",
|
|
19
|
+
"capabilities": [],
|
|
20
|
+
"labels": []
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { compile } from './vendor/schemastery.mjs'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-fixtures/sec16-vendor-path",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.mjs"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"dsh": ">=0.2.2-alpha.2 <0.3.0"
|
|
12
|
+
},
|
|
13
|
+
"dsh": {
|
|
14
|
+
"manifestVersion": 1,
|
|
15
|
+
"kind": "plugin",
|
|
16
|
+
"capabilities": [],
|
|
17
|
+
"labels": []
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
* evidence url/sha256 kept for compatibility; reportUrl/
|
|
21
21
|
* reportSha256 are the same values under the new names
|
|
22
22
|
* checkedBy {checker, command} that produced the audit
|
|
23
|
+
* security optional {state, checks, summary, command} from
|
|
24
|
+
* `--security-report`; state is derived from the 22
|
|
25
|
+
* coverage values, never hand-set. It is not a security
|
|
26
|
+
* audit and must not be rendered as one.
|
|
23
27
|
* notChecked short honest list of what the run did not exercise
|
|
24
28
|
*
|
|
25
29
|
* Deliberately absent: advice (author view), issuer / recordHash / verifyUrl
|
|
@@ -52,7 +56,12 @@ const FORBIDDEN = new Set(['advice', 'issuer', 'recordHash', 'verifyUrl', 'score
|
|
|
52
56
|
const NOT_CLAIMED = ['official', 'certification', 'security-audit', 'endorsement', 'ordering', 'comparison', 'warranty']
|
|
53
57
|
const CHECK_KEYS = new Set(['id', 'result', 'coverage'])
|
|
54
58
|
const SCOPE_KEYS = new Set(['dsh', 'cordis', 'platform'])
|
|
55
|
-
const CHECKED_BY_KEYS = new Set(['checker', 'command'])
|
|
59
|
+
const CHECKED_BY_KEYS = new Set(['checker', 'command', 'securityCommand'])
|
|
60
|
+
const SECURITY_KEYS = new Set(['state', 'checks', 'summary', 'command'])
|
|
61
|
+
const SECURITY_STATES = new Set(['checked', 'partial', 'not-run'])
|
|
62
|
+
const SECURITY_RESULTS = new Set(['PASS', 'WARN', 'FAIL', 'NA'])
|
|
63
|
+
const SECURITY_COVERAGE = new Set(['full', 'partial', 'not-run'])
|
|
64
|
+
const SECURITY_SUMMARY_KEYS = new Set(['total', 'checked', 'blocking', 'warn', 'na', 'notRun'])
|
|
56
65
|
const REPO_GIT_SHORTHAND = /^github:([^/]+\/[^/]+?)(?:\.git)?$/
|
|
57
66
|
|
|
58
67
|
function usage() {
|
|
@@ -76,6 +85,8 @@ Options:
|
|
|
76
85
|
--tarball-sha256 <hex> explicit tarball sha256 (checked against --tarball)
|
|
77
86
|
--report <file> dsh-conformance/1 checker report; its checks are
|
|
78
87
|
reduced to {id,result,coverage} (no details)
|
|
88
|
+
--security-report <file> optional dsh-conformance/1 report from --scope security;
|
|
89
|
+
adds a top-level security block (checks + counts)
|
|
79
90
|
--checked-command <s> command recorded in checkedBy.command
|
|
80
91
|
--evidence-url <url> optional https evidence URL (url + reportUrl)
|
|
81
92
|
--evidence-file <file> hash this file into evidence.sha256/reportSha256
|
|
@@ -129,7 +140,7 @@ function parseArgs(argv) {
|
|
|
129
140
|
today: null, todayProvided: false, ttlDays: 90,
|
|
130
141
|
name: null, version: null, packageDir: null,
|
|
131
142
|
tarball: null, tarballSha256: null,
|
|
132
|
-
report: null, checkedCommand: null,
|
|
143
|
+
report: null, securityReport: null, checkedCommand: null,
|
|
133
144
|
evidenceUrl: null, evidenceFile: null, evidenceSha256: null,
|
|
134
145
|
checkerVersion: null, checkerSha: null,
|
|
135
146
|
indexUrl: 'https://awesome-dsh-plugin.com/index.json',
|
|
@@ -155,6 +166,7 @@ function parseArgs(argv) {
|
|
|
155
166
|
else if (arg === '--tarball') options.tarball = next()
|
|
156
167
|
else if (arg === '--tarball-sha256') options.tarballSha256 = next().toLowerCase()
|
|
157
168
|
else if (arg === '--report') options.report = next()
|
|
169
|
+
else if (arg === '--security-report') options.securityReport = next()
|
|
158
170
|
else if (arg === '--checked-command') options.checkedCommand = next()
|
|
159
171
|
else if (arg === '--evidence-url') options.evidenceUrl = next()
|
|
160
172
|
else if (arg === '--evidence-file') options.evidenceFile = next()
|
|
@@ -285,6 +297,41 @@ function extractChecks(report, name, version) {
|
|
|
285
297
|
})
|
|
286
298
|
}
|
|
287
299
|
|
|
300
|
+
function buildSecurity(report, name, version) {
|
|
301
|
+
if (!report) return null
|
|
302
|
+
if (!Array.isArray(report.checks)) throw new Error('--security-report checks must be an array')
|
|
303
|
+
if (report.subject && report.subject.name && report.subject.name !== name) {
|
|
304
|
+
throw new Error(`--security-report subject.name ${report.subject.name} does not match ${name}`)
|
|
305
|
+
}
|
|
306
|
+
if (report.subject && report.subject.version && report.subject.version !== version) {
|
|
307
|
+
throw new Error(`--security-report subject.version ${report.subject.version} does not match ${version}`)
|
|
308
|
+
}
|
|
309
|
+
const checks = report.checks.map(check => {
|
|
310
|
+
if (!check || typeof check !== 'object') throw new Error('--security-report checks must be objects')
|
|
311
|
+
if (typeof check.id !== 'string' || typeof check.result !== 'string' || typeof check.coverage !== 'string') {
|
|
312
|
+
throw new Error('--security-report checks need id/result/coverage')
|
|
313
|
+
}
|
|
314
|
+
return { id: check.id, result: check.result, coverage: check.coverage }
|
|
315
|
+
}).sort((a, b) => a.id.localeCompare(b.id))
|
|
316
|
+
const count = (predicate) => checks.filter(predicate).length
|
|
317
|
+
const checked = count(c => c.coverage !== 'not-run')
|
|
318
|
+
const total = checks.length
|
|
319
|
+
const state = checked === 0 ? 'not-run' : checked === total ? 'checked' : 'partial'
|
|
320
|
+
return {
|
|
321
|
+
state,
|
|
322
|
+
checks,
|
|
323
|
+
summary: {
|
|
324
|
+
total,
|
|
325
|
+
checked,
|
|
326
|
+
blocking: count(c => c.result === 'FAIL'),
|
|
327
|
+
warn: count(c => c.result === 'WARN'),
|
|
328
|
+
na: count(c => c.result === 'NA'),
|
|
329
|
+
notRun: count(c => c.coverage === 'not-run'),
|
|
330
|
+
},
|
|
331
|
+
command: 'dsh-standards check <package-dir> --scope security --json',
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
288
335
|
function summarizeNotChecked(audit, checks, hasReport) {
|
|
289
336
|
const items = []
|
|
290
337
|
const entry = audit?.levels?.entry && typeof audit.levels.entry === 'object' ? audit.levels.entry : {}
|
|
@@ -386,6 +433,8 @@ function entryFromAudit(audit, options, levelFile) {
|
|
|
386
433
|
|
|
387
434
|
const report = options.report ? readJson(path.resolve(options.report), '--report') : null
|
|
388
435
|
const checks = extractChecks(report, name, version)
|
|
436
|
+
const securityReport = options.securityReport ? readJson(path.resolve(options.securityReport), '--security-report') : null
|
|
437
|
+
const security = buildSecurity(securityReport, name, version)
|
|
389
438
|
|
|
390
439
|
const auditLevels = audit.levels && typeof audit.levels === 'object' ? audit.levels : {}
|
|
391
440
|
const levels = {
|
|
@@ -457,8 +506,9 @@ function entryFromAudit(audit, options, levelFile) {
|
|
|
457
506
|
scope: inferScope(meta, audit),
|
|
458
507
|
levels,
|
|
459
508
|
checks,
|
|
509
|
+
...(security ? { security } : {}),
|
|
460
510
|
evidence,
|
|
461
|
-
checkedBy: { checker, command },
|
|
511
|
+
checkedBy: security ? { checker, command, securityCommand: security.command } : { checker, command },
|
|
462
512
|
notChecked: summarizeNotChecked(audit, checks, report !== null),
|
|
463
513
|
validity: { checkedAt, expiresAt, policy: `${options.ttlDays}d` },
|
|
464
514
|
lifecycle: 'active',
|
|
@@ -624,6 +674,49 @@ function validateSidecar(sidecar) {
|
|
|
624
674
|
}
|
|
625
675
|
}
|
|
626
676
|
}
|
|
677
|
+
if (entry.security !== undefined) {
|
|
678
|
+
const sec = entry.security
|
|
679
|
+
if (!sec || typeof sec !== 'object' || Array.isArray(sec)) throw new Error(`${key}: security must be an object`)
|
|
680
|
+
for (const field of Object.keys(sec)) {
|
|
681
|
+
if (!SECURITY_KEYS.has(field)) throw new Error(`${key}: security.${field} is not part of the sidecar contract`)
|
|
682
|
+
}
|
|
683
|
+
if (!SECURITY_STATES.has(sec.state)) throw new Error(`${key}: security.state is invalid`)
|
|
684
|
+
if (!Array.isArray(sec.checks)) throw new Error(`${key}: security.checks must be an array`)
|
|
685
|
+
const securityIds = new Set()
|
|
686
|
+
const securityCounts = { total: sec.checks.length, checked: 0, blocking: 0, warn: 0, na: 0, notRun: 0 }
|
|
687
|
+
for (const check of sec.checks) {
|
|
688
|
+
if (!check || typeof check !== 'object') throw new Error(`${key}: security.checks must be objects`)
|
|
689
|
+
for (const field of Object.keys(check)) {
|
|
690
|
+
if (!CHECK_KEYS.has(field)) throw new Error(`${key}: security.checks.${field} is not part of the sidecar contract`)
|
|
691
|
+
}
|
|
692
|
+
for (const field of ['id', 'result', 'coverage']) {
|
|
693
|
+
if (typeof check[field] !== 'string' || check[field] === '') throw new Error(`${key}: security.checks.${field} is required`)
|
|
694
|
+
}
|
|
695
|
+
if (!SECURITY_RESULTS.has(check.result)) throw new Error(`${key}: security ${check.id} result must be PASS/WARN/FAIL/NA`)
|
|
696
|
+
if (!SECURITY_COVERAGE.has(check.coverage)) throw new Error(`${key}: security ${check.id} coverage must be full/partial/not-run`)
|
|
697
|
+
if (securityIds.has(check.id)) throw new Error(`${key}: duplicate security check id ${check.id}`)
|
|
698
|
+
securityIds.add(check.id)
|
|
699
|
+
if (check.coverage === 'not-run') securityCounts.notRun += 1
|
|
700
|
+
else securityCounts.checked += 1
|
|
701
|
+
if (check.result === 'FAIL') securityCounts.blocking += 1
|
|
702
|
+
if (check.result === 'WARN') securityCounts.warn += 1
|
|
703
|
+
if (check.result === 'NA') securityCounts.na += 1
|
|
704
|
+
}
|
|
705
|
+
const summary = sec.summary
|
|
706
|
+
if (!summary || typeof summary !== 'object') throw new Error(`${key}: security.summary must be an object`)
|
|
707
|
+
for (const field of Object.keys(summary)) {
|
|
708
|
+
if (!SECURITY_SUMMARY_KEYS.has(field)) throw new Error(`${key}: security.summary.${field} is not part of the sidecar contract`)
|
|
709
|
+
}
|
|
710
|
+
for (const field of ['total', 'checked', 'blocking', 'warn', 'na', 'notRun']) {
|
|
711
|
+
if (!Number.isInteger(summary[field]) || summary[field] < 0) throw new Error(`${key}: security.summary.${field} is invalid`)
|
|
712
|
+
if (summary[field] !== securityCounts[field]) throw new Error(`${key}: security.summary.${field} must equal ${securityCounts[field]} derived from checks`)
|
|
713
|
+
}
|
|
714
|
+
const expectedState = securityCounts.checked === 0
|
|
715
|
+
? 'not-run'
|
|
716
|
+
: securityCounts.checked === securityCounts.total ? 'checked' : 'partial'
|
|
717
|
+
if (sec.state !== expectedState) throw new Error(`${key}: security.state must be ${expectedState} for the recorded coverage`)
|
|
718
|
+
if (typeof sec.command !== 'string' || sec.command === '') throw new Error(`${key}: security.command is required`)
|
|
719
|
+
}
|
|
627
720
|
if (entry.notChecked !== undefined) {
|
|
628
721
|
if (!Array.isArray(entry.notChecked)) throw new Error(`${key}: notChecked must be an array`)
|
|
629
722
|
for (const item of entry.notChecked) {
|
|
@@ -48,9 +48,20 @@ const HERE = path.dirname(fileURLToPath(import.meta.url))
|
|
|
48
48
|
const STD = path.resolve(HERE, '..', '..')
|
|
49
49
|
const JOURNEY_STATIC = path.join(HERE, 'journey.mjs')
|
|
50
50
|
const JOURNEY_RUNTIME = path.join(HERE, 'journey-runtime.mjs')
|
|
51
|
-
const NPM = process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
|
52
51
|
const GIT = process.platform === 'win32' ? 'git.exe' : 'git'
|
|
53
52
|
|
|
53
|
+
/**
|
|
54
|
+
* npm's Windows launcher is `npm.cmd`. Since Node 18.20/20.12 a direct
|
|
55
|
+
* spawnSync('npm.cmd', ...) without a shell fails with EINVAL (the
|
|
56
|
+
* CVE-2024-27980 mitigation). Go through the shell, which uses `cmd.exe /c`
|
|
57
|
+
* under the hood; Linux stays a direct spawn. Exported so the platform choice
|
|
58
|
+
* is testable without running npm.
|
|
59
|
+
*/
|
|
60
|
+
export function npmPackInvocation(platform = process.platform, args = ['pack', '--ignore-scripts', '--json']) {
|
|
61
|
+
if (platform === 'win32') return { command: 'npm.cmd', args, shell: true }
|
|
62
|
+
return { command: 'npm', args, shell: false }
|
|
63
|
+
}
|
|
64
|
+
|
|
54
65
|
const STATIC_CHECK_IDS = {
|
|
55
66
|
J1: 'J1.install', J2: 'J2.toggle', J3: 'J3.config', J4: 'J4.first-run',
|
|
56
67
|
J5: 'J5.permissions', J6: 'J6.upgrade', J7: 'J7.observe', J8: 'J8.client',
|
|
@@ -147,11 +158,11 @@ function quoteCommand(command) {
|
|
|
147
158
|
return command.map(part => (/^[A-Za-z0-9_./:@=+-]+$/.test(part) ? part : `'${String(part).replace(/'/g, "'\\''")}'`)).join(' ')
|
|
148
159
|
}
|
|
149
160
|
|
|
150
|
-
function run(command, args, { cwd, env, timeout = 120_000 } = {}) {
|
|
161
|
+
function run(command, args, { cwd, env, timeout = 120_000, shell = false } = {}) {
|
|
151
162
|
const startedAt = nowIso()
|
|
152
163
|
const t0 = Date.now()
|
|
153
164
|
const result = spawnSync(command, args, {
|
|
154
|
-
cwd, env, encoding: 'utf8', timeout, maxBuffer: 16 * 1024 * 1024, killSignal: 'SIGKILL',
|
|
165
|
+
cwd, env, encoding: 'utf8', timeout, maxBuffer: 16 * 1024 * 1024, killSignal: 'SIGKILL', shell,
|
|
155
166
|
})
|
|
156
167
|
const endedAt = nowIso()
|
|
157
168
|
return {
|
|
@@ -539,7 +550,8 @@ async function main() {
|
|
|
539
550
|
|
|
540
551
|
function packSubject(copy, tmpRoot, childEnv, timeout) {
|
|
541
552
|
const destination = fs.mkdtempSync(path.join(tmpRoot, 'pack-'))
|
|
542
|
-
const
|
|
553
|
+
const invocation = npmPackInvocation(process.platform, ['pack', '--ignore-scripts', '--json', '--pack-destination', destination])
|
|
554
|
+
const runResult = run(invocation.command, invocation.args, { cwd: copy, env: childEnv(), timeout, shell: invocation.shell })
|
|
543
555
|
if (runResult.exitCode !== 0) {
|
|
544
556
|
throw new Error(`npm pack failed (exit ${runResult.exitCode}): ${tailLines(runResult.stderrText, 10)}`)
|
|
545
557
|
}
|
|
@@ -613,7 +625,13 @@ function collectHints(journeyId, checks, hints, outDir, logDir, toEvidencePath)
|
|
|
613
625
|
}
|
|
614
626
|
}
|
|
615
627
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
628
|
+
// Run only when executed as a CLI. Importing the module (for
|
|
629
|
+
// npmPackInvocation in tests) must not start a collection.
|
|
630
|
+
const invokedAsScript = typeof process.argv[1] === 'string'
|
|
631
|
+
&& ['flow-collect.mjs', 'dsh-flow-collect.mjs', 'dsh-flow-collect'].includes(path.basename(process.argv[1]))
|
|
632
|
+
if (invokedAsScript) {
|
|
633
|
+
main().catch(error => {
|
|
634
|
+
console.error(`flow-collect: ${error.message}`)
|
|
635
|
+
process.exitCode = 3
|
|
636
|
+
})
|
|
637
|
+
}
|
|
@@ -39,6 +39,7 @@ const VALUE_FLAGS = new Set([
|
|
|
39
39
|
'--scope', '--profile', '--runtime', '--runtime-version', '--cordis-version', '--commit',
|
|
40
40
|
'--install-spec', '--market-index', '--plugin-name', '--timeout', '--host', '--base',
|
|
41
41
|
'--web', '--bare', '--entry-runtime', '--entry-claim', '--max-files', '--max-bytes',
|
|
42
|
+
'--registry-dir',
|
|
42
43
|
])
|
|
43
44
|
|
|
44
45
|
export function checkUsage() {
|
|
@@ -54,6 +55,7 @@ Options:
|
|
|
54
55
|
--html <file> write a single-file HTML report (inline CSS, no assets)
|
|
55
56
|
--host-version <v> host dsh version for the anchor (default: $DSH_HOST_VERSION)
|
|
56
57
|
--allow-host-probe resolve the \`dsh\` JS entry and run \`node <entry> --version\`
|
|
58
|
+
--registry-dir <dir> read a dsh registry layout (dsh.plugin.json) instead of package.json
|
|
57
59
|
--help show this help
|
|
58
60
|
|
|
59
61
|
Safety:
|
|
@@ -349,6 +351,10 @@ function safetyBanner(report) {
|
|
|
349
351
|
}
|
|
350
352
|
if (!safety.hostVersionKnown) {
|
|
351
353
|
lines.push(`> host 版本未知:anchor.dsh=\`${anchor.dsh ?? '?'}\` 是默认值(source=${anchor.runtimeSource ?? 'default'}, suspect=${anchor.suspect ?? true})。用 \`--host-version\`、\`DSH_HOST_VERSION\` 或 \`--allow-host-probe\` 指定宿主版本。`)
|
|
354
|
+
// An explicit --runtime-version still judges C-2, even without a host.
|
|
355
|
+
if (!safety.runtimeVersionExplicit && anchor.runtimeSource !== 'host') {
|
|
356
|
+
lines.push('> C-2.1/C-2.2 兼容性未判定(NA/partial):未指定 host 版本,不能把默认常量当成真实宿主。')
|
|
357
|
+
}
|
|
352
358
|
} else {
|
|
353
359
|
lines.push(`> host 版本 \`${anchor.dsh}\`(来源:${anchor.hostVersionSource ?? 'host'});anchor.source=${anchor.runtimeSource ?? 'host'}。`)
|
|
354
360
|
}
|
|
@@ -382,7 +388,10 @@ export function runCheck(argv = process.argv.slice(2)) {
|
|
|
382
388
|
hostInfo = resolveHostVersion({ hostVersion: options.hostVersion, allowHostProbe: options.allowHostProbe })
|
|
383
389
|
const forwarded = [...safety.args, ...options.passthrough]
|
|
384
390
|
if (hostInfo.version && !hasFlag(options.passthrough, '--runtime-version')) {
|
|
385
|
-
|
|
391
|
+
// Pass the host anchor as --host-version so the checker's own headline
|
|
392
|
+
// and anchor source already say `host`; applyHostAnchor then only fills
|
|
393
|
+
// in the author-facing provenance fields.
|
|
394
|
+
forwarded.push('--host-version', hostInfo.version)
|
|
386
395
|
}
|
|
387
396
|
result = invokeChecker(options, forwarded)
|
|
388
397
|
} catch (error) {
|
package/40-checker/src/cli.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import path from 'node:path'
|
|
|
4
4
|
import { fileURLToPath } from 'node:url'
|
|
5
5
|
import { runManifestChecks, DEFAULT_RUNTIME_VERSION } from './manifest.mjs'
|
|
6
6
|
import { checkCapabilities, checkCredentials, checkImportTimeAdvisory, checkLabels } from './declarations.mjs'
|
|
7
|
+
import { parseVersion } from './semver.mjs'
|
|
7
8
|
import { runSecurityChecks } from './security.mjs'
|
|
8
9
|
import { runRuntimeChecks } from './runtime.mjs'
|
|
9
10
|
import { runStaticBundleChecks } from './bundle-static.mjs'
|
|
@@ -40,6 +41,10 @@ Options:
|
|
|
40
41
|
--runtime [path|auto] built @deepseek-ai/cordis lib/index.js (or its package dir); bare or
|
|
41
42
|
'auto' resolves from the installed dsh; enables real L1-L3
|
|
42
43
|
--runtime-version <v> dsh runtime version used for C-2 (default: host via \`dsh --version\`, else ${DEFAULT_RUNTIME_VERSION})
|
|
44
|
+
--host-version <v> explicit host dsh version for C-2 (skips \`dsh --version\`; when neither is
|
|
45
|
+
available the anchor is source=default, suspect=true and C-2 is NA/partial)
|
|
46
|
+
--registry-dir <dir> read a dsh registry layout (dsh.plugin.json) instead of package.json;
|
|
47
|
+
a <dir> that only has dsh.plugin.json is auto-detected
|
|
43
48
|
--cordis-version <v> cordis version recorded in the anchor (default: ${DEFAULT_CORDIS})
|
|
44
49
|
--commit <sha> harness commit recorded in the anchor (default: ${DEFAULT_COMMIT.slice(0, 12)})
|
|
45
50
|
--install-spec <spec> recommended install spec for C-3 (listing/install check)
|
|
@@ -49,6 +54,9 @@ Options:
|
|
|
49
54
|
--max-files <n> source scan file budget (default: 400)
|
|
50
55
|
--max-bytes <n> source scan byte budget (default: 2000000)
|
|
51
56
|
--no-exec skip L1-L3 entirely (reported as not-run/NA, never PASS)
|
|
57
|
+
--strict-vendor DSC-16: do not downgrade eval/new Function in vendored/third-party
|
|
58
|
+
files to WARN (alias: --no-vendor-exempt); the default keeps the
|
|
59
|
+
historical FAIL for first-party code and exempts vendored files only
|
|
52
60
|
--static-only M1 mode: listing profile, only C-1/C-2/C-3/C-11/C-12/C-13; C-4..C-9 are out of scope
|
|
53
61
|
--treat-as-plugin run L1-L3 on a bundle's server entry (lib/index.js, index.js, lib/public-entry.js, src/index.ts)
|
|
54
62
|
--entry-runtime require|server-entry entry scope: require full G0-G3 (default) or accept server-entry proxy (not bundle)
|
|
@@ -81,6 +89,8 @@ function parseArgs(argv) {
|
|
|
81
89
|
profile: null,
|
|
82
90
|
runtime: null,
|
|
83
91
|
runtimeVersion: null,
|
|
92
|
+
hostVersion: null,
|
|
93
|
+
registryDir: null,
|
|
84
94
|
cordisVersion: DEFAULT_CORDIS,
|
|
85
95
|
commit: DEFAULT_COMMIT,
|
|
86
96
|
installSpec: null,
|
|
@@ -90,6 +100,7 @@ function parseArgs(argv) {
|
|
|
90
100
|
maxFiles: 400,
|
|
91
101
|
maxBytes: 2_000_000,
|
|
92
102
|
noExec: false,
|
|
103
|
+
strictVendor: false,
|
|
93
104
|
staticOnly: false,
|
|
94
105
|
treatAsPlugin: false,
|
|
95
106
|
entryRuntime: 'require',
|
|
@@ -133,6 +144,8 @@ function parseArgs(argv) {
|
|
|
133
144
|
break
|
|
134
145
|
}
|
|
135
146
|
case '--runtime-version': options.runtimeVersion = value(); break
|
|
147
|
+
case '--host-version': options.hostVersion = value(); break
|
|
148
|
+
case '--registry-dir': options.registryDir = value(); break
|
|
136
149
|
case '--cordis-version': options.cordisVersion = value(); break
|
|
137
150
|
case '--commit': options.commit = value(); break
|
|
138
151
|
case '--install-spec': options.installSpec = value(); break
|
|
@@ -143,6 +156,8 @@ function parseArgs(argv) {
|
|
|
143
156
|
case '--max-bytes': options.maxBytes = Number(value()); break
|
|
144
157
|
case '--out': options.out = value(); break
|
|
145
158
|
case '--no-exec': options.noExec = true; break
|
|
159
|
+
case '--strict-vendor': options.strictVendor = true; break
|
|
160
|
+
case '--no-vendor-exempt': options.strictVendor = true; break
|
|
146
161
|
case '--static-only': options.staticOnly = true; break
|
|
147
162
|
case '--treat-as-plugin': options.treatAsPlugin = true; break
|
|
148
163
|
case '--entry-runtime': options.entryRuntime = value(); break
|
|
@@ -174,6 +189,12 @@ function parseArgs(argv) {
|
|
|
174
189
|
if (!Number.isFinite(options.timeoutMs) || options.timeoutMs < 100 || options.timeoutMs > 120_000) throw new Error('--timeout must be between 100 and 120000 ms')
|
|
175
190
|
if (!Number.isInteger(options.maxFiles) || options.maxFiles < 1 || options.maxFiles > 200_000) throw new Error('--max-files must be an integer between 1 and 200000')
|
|
176
191
|
if (!Number.isInteger(options.maxBytes) || options.maxBytes < 1000 || options.maxBytes > 2_000_000_000) throw new Error('--max-bytes must be an integer between 1000 and 2000000000')
|
|
192
|
+
if (options.hostVersion !== null) {
|
|
193
|
+
const normalized = String(options.hostVersion).trim().replace(/^v/, '')
|
|
194
|
+
if (normalized === '' || parseVersion(normalized) === null) throw new Error('--host-version must be an exact semver version')
|
|
195
|
+
options.hostVersion = normalized
|
|
196
|
+
}
|
|
197
|
+
if (options.registryDir !== null && String(options.registryDir).trim() === '') throw new Error('--registry-dir needs a directory')
|
|
177
198
|
if (options.target === null) options.target = '.'
|
|
178
199
|
return options
|
|
179
200
|
}
|
|
@@ -486,8 +507,9 @@ export function detectHostRuntime({ bin = process.env.DSH_BIN || (process.platfo
|
|
|
486
507
|
/**
|
|
487
508
|
* Resolve what `anchor.dsh` means:
|
|
488
509
|
* cli the caller passed --runtime-version; suspect when it differs from the host
|
|
489
|
-
* host
|
|
490
|
-
*
|
|
510
|
+
* host the host version is known (--host-version or a successful `dsh --version`)
|
|
511
|
+
* default no host version is available: the constant is only a placeholder, so
|
|
512
|
+
* `suspect` is true and C-2 must be reported as not judged (NA/partial)
|
|
491
513
|
*/
|
|
492
514
|
export function resolveRuntimeAnchor(requestedVersion = null, hostVersion = null) {
|
|
493
515
|
if (typeof requestedVersion === 'string' && requestedVersion.trim() !== '') {
|
|
@@ -502,7 +524,7 @@ export function resolveRuntimeAnchor(requestedVersion = null, hostVersion = null
|
|
|
502
524
|
if (typeof hostVersion === 'string' && hostVersion !== '') {
|
|
503
525
|
return { dsh: hostVersion, runtimeSource: 'host', hostVersion, suspect: false }
|
|
504
526
|
}
|
|
505
|
-
return { dsh: DEFAULT_RUNTIME_VERSION, runtimeSource: '
|
|
527
|
+
return { dsh: DEFAULT_RUNTIME_VERSION, runtimeSource: 'default', hostVersion: null, suspect: true }
|
|
506
528
|
}
|
|
507
529
|
|
|
508
530
|
/** The five optional declaration surfaces, counted but never scored. */
|
|
@@ -531,6 +553,53 @@ function anchorOf(options, runtimeInfo, runtimePath) {
|
|
|
531
553
|
}
|
|
532
554
|
}
|
|
533
555
|
|
|
556
|
+
/**
|
|
557
|
+
* `howToEnable` is normally derived by report.mjs from the check id alone. A
|
|
558
|
+
* check can know a better answer (e.g. C-2 needs a host version), so copy the
|
|
559
|
+
* check-level hint onto its bucket/notChecked rows. This is additive: the
|
|
560
|
+
* verdict never reads it.
|
|
561
|
+
*/
|
|
562
|
+
export function applyCheckHowToEnable(report) {
|
|
563
|
+
const byId = new Map((report?.checks ?? [])
|
|
564
|
+
.filter(item => typeof item?.howToEnable === 'string' && item.howToEnable !== '')
|
|
565
|
+
.map(item => [item.id, item.howToEnable]))
|
|
566
|
+
if (byId.size === 0) return report
|
|
567
|
+
const rows = [
|
|
568
|
+
...(report.notChecked ?? []),
|
|
569
|
+
...(report.buckets?.notChecked ?? []),
|
|
570
|
+
...(report.buckets?.partial ?? []),
|
|
571
|
+
]
|
|
572
|
+
for (const row of rows) {
|
|
573
|
+
if (byId.has(row.id)) row.howToEnable = byId.get(row.id)
|
|
574
|
+
}
|
|
575
|
+
return report
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* When the anchor is the unchecked-in default, C-2 compatibility was not
|
|
580
|
+
* judged. Keep the check at NA/partial and say, in the report itself, how to
|
|
581
|
+
* supply a host version. Never turn the placeholder into a FAIL.
|
|
582
|
+
*/
|
|
583
|
+
export function annotateUnknownHostCompatibility(report, runtimeInfo) {
|
|
584
|
+
if (runtimeInfo?.runtimeSource !== 'default') return report
|
|
585
|
+
const howToEnable = 'pass --host-version <v> (or run `check --allow-host-probe`); without a host version C-2.1/C-2.2 stay NA and compatibility is not judged'
|
|
586
|
+
const note = 'C-2 compatibility not judged: 未指定 host 版本,兼容性未判定 (pass --host-version <v> or --allow-host-probe)'
|
|
587
|
+
const compat = (report.checks ?? []).find(item => item.id === 'DSC-02')
|
|
588
|
+
if (compat) {
|
|
589
|
+
compat.coverage = 'partial'
|
|
590
|
+
compat.howToEnable = howToEnable
|
|
591
|
+
}
|
|
592
|
+
for (const row of [...(report.notChecked ?? []), ...(report.buckets?.notChecked ?? []), ...(report.buckets?.partial ?? [])]) {
|
|
593
|
+
if (row.id !== 'DSC-02') continue
|
|
594
|
+
row.coverage = 'partial'
|
|
595
|
+
row.howToEnable = howToEnable
|
|
596
|
+
}
|
|
597
|
+
if (report.conclusion && !String(report.conclusion.reason ?? '').includes('兼容性未判定')) {
|
|
598
|
+
report.conclusion.reason = [report.conclusion.reason, note].filter(Boolean).join('; ')
|
|
599
|
+
}
|
|
600
|
+
return report
|
|
601
|
+
}
|
|
602
|
+
|
|
534
603
|
export async function main(argv = process.argv.slice(2)) {
|
|
535
604
|
let options
|
|
536
605
|
try {
|
|
@@ -543,7 +612,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
543
612
|
if (options.help) { process.stdout.write(usage()); return 0 }
|
|
544
613
|
if (options.version) { process.stdout.write(`${VERSION}\n`); return 0 }
|
|
545
614
|
|
|
546
|
-
const dir = path.resolve(options.target)
|
|
615
|
+
const dir = path.resolve(options.registryDir ?? options.target)
|
|
547
616
|
let stat
|
|
548
617
|
try { stat = fs.statSync(dir) } catch {
|
|
549
618
|
process.stderr.write(`dsh-plugin-verify: target not found: ${dir}\n`)
|
|
@@ -553,13 +622,28 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
553
622
|
process.stderr.write(`dsh-plugin-verify: target must be a package directory (tarball support is not in the MVP): ${dir}\n`)
|
|
554
623
|
return 3
|
|
555
624
|
}
|
|
556
|
-
|
|
557
|
-
|
|
625
|
+
const hasPackageJson = fs.existsSync(path.join(dir, 'package.json'))
|
|
626
|
+
const hasRegistryManifest = fs.existsSync(path.join(dir, 'dsh.plugin.json'))
|
|
627
|
+
if (!hasPackageJson && !hasRegistryManifest) {
|
|
628
|
+
process.stderr.write(`dsh-plugin-verify: not a package directory (no package.json or dsh.plugin.json): ${dir}\n`)
|
|
629
|
+
return 3
|
|
630
|
+
}
|
|
631
|
+
if (options.registryDir !== null && !hasRegistryManifest) {
|
|
632
|
+
process.stderr.write(`dsh-plugin-verify: --registry-dir has no dsh.plugin.json: ${dir}\n`)
|
|
558
633
|
return 3
|
|
559
634
|
}
|
|
635
|
+
// A sidebar-style `registry/` output has only dsh.plugin.json. Auto-detect it,
|
|
636
|
+
// and let --registry-dir force that mode even when a package.json is present.
|
|
637
|
+
const registryMode = options.registryDir !== null || (!hasPackageJson && hasRegistryManifest)
|
|
560
638
|
|
|
561
|
-
|
|
639
|
+
// --host-version is an explicit anchor and skips PATH probing entirely.
|
|
640
|
+
// Otherwise the legacy best-effort `dsh --version` probe still runs; when it
|
|
641
|
+
// fails the anchor is the default constant, suspect=true, and C-2 is NA.
|
|
642
|
+
const host = options.hostVersion !== null
|
|
643
|
+
? { version: options.hostVersion, bin: '--host-version', error: null }
|
|
644
|
+
: detectHostRuntime()
|
|
562
645
|
const runtimeInfo = resolveRuntimeAnchor(options.runtimeVersion, host.version)
|
|
646
|
+
const compatibilityKnown = runtimeInfo.runtimeSource !== 'default'
|
|
563
647
|
|
|
564
648
|
// `--runtime auto` / `--host auto` resolve from the installed dsh. A value
|
|
565
649
|
// that still cannot be resolved is a usage error: silently skipping the run
|
|
@@ -580,7 +664,9 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
580
664
|
return 3
|
|
581
665
|
}
|
|
582
666
|
|
|
583
|
-
const { manifest, kind, kindInferred, entry, patch, g4, checks: manifestChecks } = runManifestChecks(dir, {
|
|
667
|
+
const { manifest, manifestSource, kind, kindInferred, entry, patch, g4, checks: manifestChecks } = runManifestChecks(dir, {
|
|
668
|
+
registry: registryMode,
|
|
669
|
+
compatibilityKnown,
|
|
584
670
|
runtimeVersion: runtimeInfo.dsh,
|
|
585
671
|
installSpec: options.installSpec,
|
|
586
672
|
marketIndex: options.marketIndex,
|
|
@@ -605,7 +691,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
605
691
|
]
|
|
606
692
|
const declarationAdjusted = declarationChecks.map(item => (item.result === 'WARN' && ['DSC-11', 'DSC-13'].includes(item.id) ? { ...item, advisory: true } : item))
|
|
607
693
|
const advisoryChecks = [checkImportTimeAdvisory(sources, entry?.relative, scan)]
|
|
608
|
-
const securityChecks = runSecurityChecks({ dir, manifest, sources, entry, kind })
|
|
694
|
+
const securityChecks = runSecurityChecks({ dir, manifest, sources, entry, kind, strictVendor: options.strictVendor })
|
|
609
695
|
|
|
610
696
|
if (options.scope === 'entry' && options.entryRuntime === 'server-entry' && kind !== 'plugin') options.treatAsPlugin = true
|
|
611
697
|
let runtimeKind = kind
|
|
@@ -746,6 +832,9 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
746
832
|
name: manifest?.name ?? null,
|
|
747
833
|
version: manifest?.version ?? null,
|
|
748
834
|
path: dir,
|
|
835
|
+
// Additive: a registry layout (dsh.plugin.json, no package.json) is a
|
|
836
|
+
// different input contract from an npm package directory.
|
|
837
|
+
...(manifestSource === 'registry' ? { source: 'registry' } : {}),
|
|
749
838
|
}
|
|
750
839
|
const report = buildReport({
|
|
751
840
|
subject,
|
|
@@ -763,6 +852,8 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
763
852
|
runtimeChecks: runtimeSummary,
|
|
764
853
|
securityChecks,
|
|
765
854
|
})
|
|
855
|
+
applyCheckHowToEnable(report)
|
|
856
|
+
annotateUnknownHostCompatibility(report, runtimeInfo)
|
|
766
857
|
// An explicitly requested runtime/host run that could not produce a result
|
|
767
858
|
// is not a clean static pass: the caller asked for execution, so say the run
|
|
768
859
|
// is incomplete. A static report (no flag) is unaffected.
|