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
|
@@ -548,6 +548,158 @@ function functionConstructorExempt(node, ancestors) {
|
|
|
548
548
|
return allowsEvalContext(ancestors)
|
|
549
549
|
}
|
|
550
550
|
|
|
551
|
+
// --- vendor-aware C-16.1 exemption -----------------------------------------
|
|
552
|
+
//
|
|
553
|
+
// A package may legitimately ship third-party code verbatim: a `vendor/` tree, a
|
|
554
|
+
// node_modules tree kept in the tarball, or a bundler inlined library (the
|
|
555
|
+
// `//#region node_modules/...` markers esbuild/rolldown emit). A schema/utility
|
|
556
|
+
// library such as `@deepseek-ai/schemastery` uses `new Function("return " + src)`
|
|
557
|
+
// to compile a *declared callback* into a function; that is a library parser,
|
|
558
|
+
// not a malicious payload, and hard-failing every package that bundles it would
|
|
559
|
+
// punish exactly the packages that declare their dependencies honestly.
|
|
560
|
+
//
|
|
561
|
+
// The exemption is deliberately narrow. Only `eval()` / `new Function()` sites
|
|
562
|
+
// are affected (never vm, module._compile, process.binding, dangerous
|
|
563
|
+
// subprocess commands, or base64-obfuscated code), the file must look vendored,
|
|
564
|
+
// the result is WARN (never PASS), and `--strict-vendor` restores FAIL.
|
|
565
|
+
const VENDOR_DIRECTORY = /(?:^|\/)((?:node_modules|vendor|vendored|third[-_]?party|thirdparty|deps))(?:\/|$)/i
|
|
566
|
+
const VENDOR_LIBRARY_NAMES = new Set(['@deepseek-ai/schemastery', 'schemastery', 'ajv', 'lodash'])
|
|
567
|
+
const VENDOR_LIBRARY_SIGNATURES = [
|
|
568
|
+
{ name: '@deepseek-ai/schemastery', pattern: /Symbol\.for\(\s*['"]schemastery['"]\s*\)|__schemastery_(?:index|refs)__/ },
|
|
569
|
+
{ name: 'ajv', pattern: /\bAjv\.prototype\b|\bclass\s+Ajv\b|\bfunction\s+Ajv\b|\bajv@\d+\.\d+\.\d+/ },
|
|
570
|
+
{ name: 'lodash', pattern: /__lodash_hash_undefined__|\bLodashWrapper\b|\blodash@\d+\.\d+\.\d+/ },
|
|
571
|
+
]
|
|
572
|
+
const BUNDLED_VENDOR_REGION = /^[ \t]*(?:\/\/|\/\*)(?=[^\n]*(?:#region|\bregion\b|\.pnpm[\\/]))[^\n]*?\bnode_modules[\\/](?:\.pnpm[\\/])?((?:@[^/\s+]+[+/])?[^@/\s'"`]+)/i
|
|
573
|
+
const BUNDLED_VENDOR_END = /^[ \t]*(?:\/\/|\/\*)\s*#?endregion\b/i
|
|
574
|
+
const VENDORED_BASENAME = /^(?:schemastery|ajv|lodash)(?:[.-]|$)/i
|
|
575
|
+
const VENDOR_EXEMPT_WHAT = new Set(['eval()', 'new Function()'])
|
|
576
|
+
|
|
577
|
+
/** `@deepseek-ai+schemastery` (the `.pnpm` form) -> `@deepseek-ai/schemastery`. */
|
|
578
|
+
function normalizeVendorPackage(token) {
|
|
579
|
+
if (!token) return null
|
|
580
|
+
const value = String(token).replace(/\\/g, '/')
|
|
581
|
+
if (value.startsWith('@') && !value.includes('/')) return value.replace('+', '/')
|
|
582
|
+
return value
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function declaredVendorLibraries(manifest) {
|
|
586
|
+
const declared = new Set()
|
|
587
|
+
// devDependencies count: a bundle inlines a library that is only needed at
|
|
588
|
+
// build time, so that is exactly where a bundled dependency is declared.
|
|
589
|
+
for (const field of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
|
|
590
|
+
const block = manifest?.[field]
|
|
591
|
+
if (!block || typeof block !== 'object') continue
|
|
592
|
+
for (const name of Object.keys(block)) if (VENDOR_LIBRARY_NAMES.has(name)) declared.add(name)
|
|
593
|
+
}
|
|
594
|
+
return declared
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Line ranges of bundler-emitted `node_modules` regions. One bundle often inlines
|
|
599
|
+
* several libraries (the composer bundle starts with cosmokit, then schemastery),
|
|
600
|
+
* so the evidence for a finding is the region that contains its line, not the
|
|
601
|
+
* first region in the file.
|
|
602
|
+
*/
|
|
603
|
+
function bundlerRegionsOf(text) {
|
|
604
|
+
const lines = String(text).split('\n')
|
|
605
|
+
const regions = []
|
|
606
|
+
const open = []
|
|
607
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
608
|
+
const startMatch = BUNDLED_VENDOR_REGION.exec(lines[index])
|
|
609
|
+
if (startMatch) {
|
|
610
|
+
const library = normalizeVendorPackage(startMatch[1])
|
|
611
|
+
if (library) open.push({ start: index + 1, library })
|
|
612
|
+
continue
|
|
613
|
+
}
|
|
614
|
+
if (BUNDLED_VENDOR_END.test(lines[index]) && open.length > 0) {
|
|
615
|
+
regions.push({ ...open.pop(), end: index + 1 })
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
for (const region of open) regions.push({ ...region, end: lines.length })
|
|
619
|
+
return regions
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/** The region/evidence that applies to one finding line. */
|
|
623
|
+
function vendorEvidenceAt(evidence, line) {
|
|
624
|
+
if (!evidence?.regions) return evidence
|
|
625
|
+
const region = evidence.regions.find(item => line >= item.start && line <= item.end)
|
|
626
|
+
if (!region) return { ...evidence, regions: undefined }
|
|
627
|
+
return {
|
|
628
|
+
kind: evidence.kind,
|
|
629
|
+
library: region.library,
|
|
630
|
+
declared: region.declared,
|
|
631
|
+
reason: `bundled node_modules region for ${region.library}${region.declared ? ' (declared dependency)' : ''}`,
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/** Own-file vendor evidence, or null. `library` is used only for reporting. */
|
|
636
|
+
function vendorEvidenceOf(relative, text, declared) {
|
|
637
|
+
const normalized = normalizeRelative(relative)
|
|
638
|
+
const pathMatch = VENDOR_DIRECTORY.exec(normalized)
|
|
639
|
+
if (pathMatch) {
|
|
640
|
+
return { kind: 'path', library: 'vendored-path', reason: `vendored path (${pathMatch[0]})` }
|
|
641
|
+
}
|
|
642
|
+
const regions = bundlerRegionsOf(text).map(region => ({ ...region, declared: declared.has(region.library) }))
|
|
643
|
+
if (regions.length > 0) {
|
|
644
|
+
const first = regions[0]
|
|
645
|
+
return {
|
|
646
|
+
kind: 'bundle',
|
|
647
|
+
library: first.library,
|
|
648
|
+
declared: first.declared,
|
|
649
|
+
regions,
|
|
650
|
+
reason: `bundled node_modules region for ${first.library}${first.declared ? ' (declared dependency)' : ''}`,
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
for (const signature of VENDOR_LIBRARY_SIGNATURES) {
|
|
654
|
+
if (signature.pattern.test(text)) {
|
|
655
|
+
return { kind: 'library', library: signature.name, declared: declared.has(signature.name), reason: `library fingerprint for ${signature.name}` }
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
const basename = path.posix.basename(normalized)
|
|
659
|
+
if (VENDORED_BASENAME.test(basename)) {
|
|
660
|
+
return { kind: 'filename', library: basename.toLowerCase(), reason: `library-shaped file name (${basename})` }
|
|
661
|
+
}
|
|
662
|
+
return null
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Map of normalized relative path -> vendor evidence for every scanned server
|
|
667
|
+
* source. A file outside `src/` also inherits a sibling's strong evidence in the
|
|
668
|
+
* same directory (bundled libraries are often split across chunks); a bare
|
|
669
|
+
* fingerprint is inherited only when the package declares that dependency.
|
|
670
|
+
*/
|
|
671
|
+
function vendorFilesFor(sources, manifest) {
|
|
672
|
+
const declared = declaredVendorLibraries(manifest)
|
|
673
|
+
const own = new Map()
|
|
674
|
+
const byDirectory = new Map()
|
|
675
|
+
for (const source of serverSources(sources)) {
|
|
676
|
+
const normalized = normalizeRelative(source.relative)
|
|
677
|
+
const evidence = vendorEvidenceOf(normalized, source.text, declared)
|
|
678
|
+
if (!evidence) continue
|
|
679
|
+
own.set(normalized, evidence)
|
|
680
|
+
const directory = path.posix.dirname(normalized)
|
|
681
|
+
if (!byDirectory.has(directory)) byDirectory.set(directory, [])
|
|
682
|
+
byDirectory.get(directory).push({ file: normalized, evidence })
|
|
683
|
+
}
|
|
684
|
+
const result = new Map(own)
|
|
685
|
+
for (const source of serverSources(sources)) {
|
|
686
|
+
const normalized = normalizeRelative(source.relative)
|
|
687
|
+
if (result.has(normalized)) continue
|
|
688
|
+
if (/(?:^|\/)src(?:\/|$)/.test(normalized)) continue
|
|
689
|
+
const directory = path.posix.dirname(normalized)
|
|
690
|
+
if (directory === '.') continue
|
|
691
|
+
const sibling = (byDirectory.get(directory) ?? []).find(item => item.file !== normalized)
|
|
692
|
+
if (!sibling) continue
|
|
693
|
+
if (sibling.evidence.kind === 'library' && !declared.has(sibling.evidence.library)) continue
|
|
694
|
+
result.set(normalized, {
|
|
695
|
+
kind: 'directory',
|
|
696
|
+
library: sibling.evidence.library,
|
|
697
|
+
reason: `${sibling.evidence.reason} in the same directory (${sibling.file})`,
|
|
698
|
+
})
|
|
699
|
+
}
|
|
700
|
+
return result
|
|
701
|
+
}
|
|
702
|
+
|
|
551
703
|
/** exec/execSync/spawn/... called directly or through a one-level alias. */
|
|
552
704
|
function commandExecApiOf(callee, bindings) {
|
|
553
705
|
if (!callee) return null
|
|
@@ -592,7 +744,8 @@ function dangerousCommandLabels(text) {
|
|
|
592
744
|
return labels
|
|
593
745
|
}
|
|
594
746
|
|
|
595
|
-
export function checkDynamicExecution(manifest, sources, entry, kind = null) {
|
|
747
|
+
export function checkDynamicExecution(manifest, sources, entry, kind = null, options = {}) {
|
|
748
|
+
const strictVendor = options.strictVendor === true
|
|
596
749
|
if (kind === 'client') {
|
|
597
750
|
return check({
|
|
598
751
|
id: 'DSC-16', clause: 'C-16', layer: 'L0', result: 'NA', coverage: 'not-run', advisory: false,
|
|
@@ -622,9 +775,11 @@ export function checkDynamicExecution(manifest, sources, entry, kind = null) {
|
|
|
622
775
|
const dynamic = []
|
|
623
776
|
const subprocess = []
|
|
624
777
|
const fileFacts = new Map()
|
|
778
|
+
const vendorFiles = vendorFilesFor(sources, manifest)
|
|
625
779
|
for (const relative of closure.visited) {
|
|
626
780
|
const parsed = parseModule(closure.byRelative.get(relative))
|
|
627
781
|
if (parsed.error) continue
|
|
782
|
+
const vendor = vendorFiles.get(relative) ?? null
|
|
628
783
|
let facts = fileFacts.get(relative)
|
|
629
784
|
if (!facts) {
|
|
630
785
|
facts = { base64Line: null, evalLike: false }
|
|
@@ -649,12 +804,16 @@ export function checkDynamicExecution(manifest, sources, entry, kind = null) {
|
|
|
649
804
|
}
|
|
650
805
|
if (node.type === 'CallExpression' && node.callee.type === 'Identifier' && node.callee.name === 'eval') {
|
|
651
806
|
facts.evalLike = true
|
|
652
|
-
|
|
807
|
+
const line = lineOf(node)
|
|
808
|
+
dynamic.push({ file: relative, line, what: 'eval()', item: 'C-16.1', vendor: vendor ? vendorEvidenceAt(vendor, line) : null })
|
|
653
809
|
return
|
|
654
810
|
}
|
|
655
811
|
if (isFunctionConstructor(node)) {
|
|
656
812
|
facts.evalLike = true
|
|
657
|
-
if (!functionConstructorExempt(node, ancestors))
|
|
813
|
+
if (!functionConstructorExempt(node, ancestors)) {
|
|
814
|
+
const line = lineOf(node)
|
|
815
|
+
dynamic.push({ file: relative, line, what: 'new Function()', item: 'C-16.1', vendor: vendor ? vendorEvidenceAt(vendor, line) : null })
|
|
816
|
+
}
|
|
658
817
|
return
|
|
659
818
|
}
|
|
660
819
|
if (node.type === 'CallExpression') {
|
|
@@ -693,17 +852,35 @@ export function checkDynamicExecution(manifest, sources, entry, kind = null) {
|
|
|
693
852
|
obfuscated.push({ file, line: facts.base64Line, what: 'base64-decoded payload in the same file as eval/new Function' })
|
|
694
853
|
}
|
|
695
854
|
}
|
|
696
|
-
|
|
855
|
+
// Vendor-aware downgrade: only eval()/new Function() in a vendored file, and
|
|
856
|
+
// only when --strict-vendor was not requested. Obfuscated, vm, _compile,
|
|
857
|
+
// process.binding and dangerous subprocess findings are never exempt.
|
|
858
|
+
const vendorExempt = strictVendor
|
|
859
|
+
? []
|
|
860
|
+
: dynamic.filter(item => item.vendor && item.item === 'C-16.1' && VENDOR_EXEMPT_WHAT.has(item.what))
|
|
861
|
+
const blockingDynamic = dynamic.filter(item => !vendorExempt.includes(item))
|
|
862
|
+
const dynamicEvidence = blockingDynamic.slice(0, 5).map(item => `${item.file}:${item.line}`)
|
|
697
863
|
const obfuscatedEvidence = obfuscated.slice(0, 5).map(item => `${item.file}:${item.line}`)
|
|
864
|
+
const vendorEvidence = vendorExempt.slice(0, 5).map(item => `${item.file}:${item.line}`)
|
|
698
865
|
const subprocessEvidence = subprocess.slice(0, 5).map(item => `${item.file}:${item.line}`)
|
|
699
|
-
for (const item of
|
|
700
|
-
|
|
866
|
+
for (const item of blockingDynamic.slice(0, 8)) {
|
|
867
|
+
const vendorNote = item.vendor ? ` [vendor: ${item.vendor.reason}; ${strictVendor ? '--strict-vendor keeps FAIL' : 'not exempt'}]` : ''
|
|
868
|
+
const row = detail(item.item, 'FAIL', `dynamic execution (code:dynamic): ${item.what} at ${item.file}:${item.line}${vendorNote}`, [`${item.file}:${item.line}`])
|
|
869
|
+
if (item.vendor) row.vendor = true
|
|
870
|
+
details.push(row)
|
|
871
|
+
}
|
|
872
|
+
for (const item of vendorExempt.slice(0, 8)) {
|
|
873
|
+
const row = detail('C-16.1', 'WARN', `dynamic execution (code:dynamic): ${item.what} at ${item.file}:${item.line} [vendor: ${item.vendor.reason}; vendor-exempt → WARN, rerun with --strict-vendor to enforce FAIL]`, [`${item.file}:${item.line}`])
|
|
874
|
+
row.vendor = true
|
|
875
|
+
details.push(row)
|
|
701
876
|
}
|
|
702
877
|
for (const item of obfuscated.slice(0, 4)) {
|
|
703
|
-
|
|
878
|
+
const vendorNote = vendorFiles.has(item.file) ? ` [vendor: ${vendorFiles.get(item.file).reason}; obfuscated code is never exempt]` : ''
|
|
879
|
+
details.push(detail('C-16.1', 'FAIL', `dynamic execution (code:obfuscated): ${item.what} at ${item.file}:${item.line}${vendorNote}`, [`${item.file}:${item.line}`]))
|
|
704
880
|
}
|
|
705
881
|
for (const item of subprocess.slice(0, 8)) {
|
|
706
|
-
|
|
882
|
+
const vendorNote = vendorFiles.has(item.file) ? ` [vendor: ${vendorFiles.get(item.file).reason}; subprocess findings are never exempt]` : ''
|
|
883
|
+
details.push(detail('C-16.3', 'WARN', `subprocess capability observed: ${item.what} at ${item.file}:${item.line}${vendorNote}`, [`${item.file}:${item.line}`]))
|
|
707
884
|
}
|
|
708
885
|
if (closure.packageImports.length > 0) {
|
|
709
886
|
details.push(detail('C-16.4', 'NA', `not-run: ${closure.packageImports.length} package import(s) are outside the local closure (for example ${closure.packageImports[0].specifier})`, [`${closure.packageImports[0].file}:${closure.packageImports[0].line}`]))
|
|
@@ -712,19 +889,24 @@ export function checkDynamicExecution(manifest, sources, entry, kind = null) {
|
|
|
712
889
|
details.push(detail('C-16.4', 'ERROR', `not-run: AST parse failed in ${error.file}:${error.line} (${error.message})`, [`${error.file}:${error.line}`]))
|
|
713
890
|
}
|
|
714
891
|
const coverage = closure.parseErrors.length > 0 || closure.packageImports.length > 0 || closure.unresolved.length > 0 ? 'partial' : 'full'
|
|
892
|
+
const vendorLibraries = [...new Set(vendorExempt.map(item => item.vendor.library))].join(', ')
|
|
715
893
|
let result
|
|
716
894
|
let reason = ''
|
|
717
|
-
if (
|
|
895
|
+
if (blockingDynamic.length > 0 || obfuscated.length > 0) {
|
|
718
896
|
result = 'FAIL'
|
|
719
|
-
reason = `${
|
|
897
|
+
reason = `${blockingDynamic.length} dynamic-execution site(s) in the server entry closure (code:dynamic)`
|
|
898
|
+
if (vendorExempt.length > 0) reason += `; ${vendorExempt.length} additional vendor-exempt site(s)`
|
|
720
899
|
if (obfuscated.length > 0) reason += `; ${obfuscated.length} base64-obfuscated execution clue(s)`
|
|
721
900
|
if (closure.parseErrors.length > 0) reason += `; ${closure.parseErrors.length} file(s) could not be parsed`
|
|
722
901
|
} else if (closure.parseErrors.length > 0) {
|
|
723
902
|
result = 'ERROR'
|
|
724
903
|
reason = `AST parse failed in ${closure.parseErrors.length} closure file(s); DSC-16 not-run`
|
|
725
|
-
} else if (subprocess.length > 0) {
|
|
904
|
+
} else if (vendorExempt.length > 0 || subprocess.length > 0) {
|
|
726
905
|
result = 'WARN'
|
|
727
|
-
|
|
906
|
+
const parts = []
|
|
907
|
+
if (vendorExempt.length > 0) parts.push(`${vendorExempt.length} vendor-exempt dynamic-execution site(s) (vendor: ${vendorLibraries}; rerun with --strict-vendor to enforce FAIL)`)
|
|
908
|
+
if (subprocess.length > 0) parts.push(`${subprocess.length} subprocess site(s)`)
|
|
909
|
+
reason = `${parts.join('; ')} in the server entry closure`
|
|
728
910
|
} else {
|
|
729
911
|
result = 'PASS'
|
|
730
912
|
}
|
|
@@ -737,7 +919,11 @@ export function checkDynamicExecution(manifest, sources, entry, kind = null) {
|
|
|
737
919
|
coverage: result === 'ERROR' ? 'not-run' : coverage,
|
|
738
920
|
reason,
|
|
739
921
|
details,
|
|
740
|
-
evidence: dynamicEvidence.length > 0
|
|
922
|
+
evidence: dynamicEvidence.length > 0
|
|
923
|
+
? dynamicEvidence
|
|
924
|
+
: obfuscatedEvidence.length > 0
|
|
925
|
+
? obfuscatedEvidence
|
|
926
|
+
: vendorEvidence.length > 0 ? vendorEvidence : subprocessEvidence.length > 0 ? subprocessEvidence : [...closure.visited].slice(0, 3),
|
|
741
927
|
})
|
|
742
928
|
}
|
|
743
929
|
|
|
@@ -1584,7 +1770,7 @@ function unavailable(reason) {
|
|
|
1584
1770
|
}
|
|
1585
1771
|
|
|
1586
1772
|
/** Run all eight security checks. Never throws: a failure becomes not-run rows. */
|
|
1587
|
-
export function runSecurityChecks({ dir, manifest, sources = [], entry = null, kind = null } = {}) {
|
|
1773
|
+
export function runSecurityChecks({ dir, manifest, sources = [], entry = null, kind = null, strictVendor = false } = {}) {
|
|
1588
1774
|
if (!manifest) return unavailable('manifest unavailable')
|
|
1589
1775
|
const checks = []
|
|
1590
1776
|
const run = (id, factory) => {
|
|
@@ -1605,7 +1791,7 @@ export function runSecurityChecks({ dir, manifest, sources = [], entry = null, k
|
|
|
1605
1791
|
}
|
|
1606
1792
|
}
|
|
1607
1793
|
run('DSC-15', () => checkLifecycleScripts(manifest, dir))
|
|
1608
|
-
run('DSC-16', () => checkDynamicExecution(manifest, sources, entry, kind))
|
|
1794
|
+
run('DSC-16', () => checkDynamicExecution(manifest, sources, entry, kind, { strictVendor }))
|
|
1609
1795
|
run('DSC-17', () => checkSensitiveFileReads(manifest, sources))
|
|
1610
1796
|
run('DSC-18', () => checkEgressEndpoints(manifest, sources))
|
|
1611
1797
|
run('DSC-19', () => checkOpaqueArtifacts(dir, sources))
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## 1.6.7 — 2026-11-07
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- `check --host-version`:显式指定宿主版本;未知时 C-2.1/C-2.2 记 NA/partial + howToEnable,不再误报 FAIL。
|
|
6
|
+
- `--registry-dir`:读取 sidebar 形态的 `registry/`(`dsh.plugin.json`),输出 `subject.source=registry`,缺 package.json 的检查记 NA。
|
|
7
|
+
- Windows:`flow-collect` 用 `npm.cmd + shell` 调 npm pack,修 `EINVAL`。
|
|
8
|
+
- sidecar 扩到 50 条;security 块正式化(state/checks/summary/command,partial ≠ 安全审计)。
|
|
9
|
+
- 离线包 `dsh-standards-offline-1.6.6.tgz`(992,962 B,64 文件)。
|
|
10
|
+
|
|
11
|
+
### Verified
|
|
12
|
+
|
|
13
|
+
- `npm test` 313/313。
|
|
14
|
+
- sidebar 0.30.1 / TUI 0.19.0 默认 entry static:exit 1/blocking 1 → exit 0/blocking 0;显式 `--host-version 0.2.1-rc.5` 仍报真实 C-2.2 FAIL。
|
|
15
|
+
|
|
16
|
+
## 1.6.6 — 2026-11-07
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- DSC-16 vendor-aware:`vendor/`、`node_modules/`、`third_party/`、`deps/` 路径,打包器 `//#region node_modules/...` 区间(按命中行判定库名),`schemastery`/`ajv`/`lodash` 库指纹/库形文件名,或同目录(`src/` 外)强证据,现在把 `eval`/`new Function` 降为 WARN(detail 记 `C-16.1` + `vendor: true`),不再进入 `security.blocking`。
|
|
21
|
+
- 新增 `--strict-vendor`(别名 `--no-vendor-exempt`)恢复 FAIL;默认行为对非 vendor 代码零变化。`vm.*`、`module._compile`、`process.binding`、危险子进程、base64+eval 永不豁免;`package.json` 依赖仅作佐证。
|
|
22
|
+
- `dsh-composer-history@0.8.16`(`lib/index.js:295` 内联 schemastery)由 fail/exit 1 → warn/exit 0;`--strict-vendor` 仍 fail/exit 1。
|
|
23
|
+
- conformance schema 的 `details[]` 新增加性 `vendor` 字段;31 号文 C-16、`CHANGELOG-RULES.md` 同步。
|
|
24
|
+
|
|
25
|
+
### Verified
|
|
26
|
+
|
|
27
|
+
- `npm test` 301/301;新增 3 个 fixture(bundle / vendor 路径 / 仅声明依赖的诱饵)与 2 个测试。
|
|
28
|
+
|
|
1
29
|
## 1.6.5 — 2026-11-07
|
|
2
30
|
|
|
3
31
|
- 31 号文 C-17 环境变量枚举的判定句与实现对齐(单独 PASS,同闭包出站才 WARN)。
|
package/docs/coverage.md
CHANGED
|
@@ -57,7 +57,7 @@ dsh-standards check <package-dir> \
|
|
|
57
57
|
| 项 | security scope 判定 | 触发 |
|
|
58
58
|
|---|---|---|
|
|
59
59
|
| `DSC-15` 生命周期脚本 | **blocking**(可 FAIL) | 安装期 `curl\|sh`、`base64 -d`、`node -e`、`sh -c`、`powershell -enc`、引用缺失脚本、写 `$HOME`/`/etc` |
|
|
60
|
-
| `DSC-16` 动态执行 | **blocking**(可 FAIL) | `eval`/`new Function(非空)`/`vm`/`module._compile`/`process.binding` → FAIL;裸 `child_process` → WARN;静态危险子进程命令 1.6.2 起 FAIL |
|
|
60
|
+
| `DSC-16` 动态执行 | **blocking**(可 FAIL) | `eval`/`new Function(非空)`/`vm`/`module._compile`/`process.binding` → FAIL;裸 `child_process` → WARN;静态危险子进程命令 1.6.2 起 FAIL;1.6.6 起 vendor/第三方文件内的 `eval`/`new Function` → WARN(`--strict-vendor` 恢复 FAIL) |
|
|
61
61
|
| `DSC-17` 敏感文件 | **blocking**(可 FAIL) | 直接读 `~/.ssh`、`$DSH_HOME` credentials、`id_rsa`、`.aws`、`.npmrc`、`.netrc` 等;`.env` 只 WARN |
|
|
62
62
|
| `DSC-18` 外联端点 | **advisory**(永不 FAIL) | 非 https、userinfo、公网裸 IP、webhook/paste/ngrok/onion、未披露端点 |
|
|
63
63
|
| `DSC-19` 混淆/二进制 | **advisory** | 二进制 sha256、超长单行、大块 base64、高熵;只登记不判恶 |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-standards",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.7",
|
|
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",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
| 计入 `total` | **默认否**:`checks[]` 仍是 14,`security` 块单独存在、不计入 `coverage`。**security 是**:`checks[]` 22,`coverage.total=22`、`coverage.mandatory=4`。 |
|
|
108
108
|
| 默认 `security.scope` | `"advisory"`。8 项照常评估,但任何 `FAIL` 封顶为 `WARN`,不改 `conclusion`/exit;`security.status` 可为 `pass`/`warn`/`incomplete`(`FAIL` 被封顶成 `WARN` 后不会出现 `fail`)。 |
|
|
109
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`。 |
|
|
110
|
+
| `security.status=fail` | **仅 security scope**:`DSC-15`/`DSC-16`/`DSC-17` 任一 FAIL;优先于 `warn`/`incomplete`。`DSC-21` 永不 FAIL;默认 advisory 模式 FAIL 封顶 WARN,不会出现 `fail`。1.6.6 起 `DSC-16` 的 vendor 豁免项记 `WARN`(detail `vendor: true`),不算 FAIL、不进 `security.blocking`;`--strict-vendor` 下恢复为 FAIL。 |
|
|
111
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
112
|
| `security.status=incomplete` | 8 项中任一结果为 `NA`/`ERROR`/`not-run`,或 8 项有缺失(未产出 `PASS`/`WARN`/`FAIL`);先于 `warn` 判定,但已有 blocking FAIL 时仍是 `fail`。 |
|
|
113
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 项)。 |
|
package/spec/dsc-clauses.json
CHANGED
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"advisory": false,
|
|
186
186
|
"docs": "31-DS-C条款.md#c-16-动态执行",
|
|
187
187
|
"parent": null,
|
|
188
|
-
"note": "security scope only; eval/Function/vm/_compile/process.binding can FAIL; bare child_process is WARN"
|
|
188
|
+
"note": "security scope only; eval/Function/vm/_compile/process.binding can FAIL; bare child_process is WARN; 1.6.6 vendor eval/Function is WARN (--strict-vendor restores FAIL)"
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
191
|
"dsc": "DSC-17",
|
package/spec/remediation.json
CHANGED
|
@@ -513,7 +513,7 @@
|
|
|
513
513
|
"C-16.1": {
|
|
514
514
|
"title": "eval / new Function 属于 code:dynamic",
|
|
515
515
|
"why": "它们绕过静态审阅,常与解码/混淆载荷组合出现。",
|
|
516
|
-
"fix": "不要用 eval/new Function;把需要的行为写成静态函数。空参 new Function(\"\") 探针不判定。",
|
|
516
|
+
"fix": "不要用 eval/new Function;把需要的行为写成静态函数。空参 new Function(\"\") 探针不判定。vendor/第三方文件内的命中只判 WARN,可用 --strict-vendor 复核。",
|
|
517
517
|
"docs": "docs/security.md#4-files-subprocesses-and-dynamic-execution-dsc-15-dsc-16-dsc-17-dsc-19",
|
|
518
518
|
"severityHint": "fail"
|
|
519
519
|
},
|
|
@@ -406,6 +406,10 @@
|
|
|
406
406
|
"type": "string"
|
|
407
407
|
},
|
|
408
408
|
"description": "Optional evidence references; the detail() helper emits [], but a few manually built details (for example the G4 detail) omit the key in 1.3.0."
|
|
409
|
+
},
|
|
410
|
+
"vendor": {
|
|
411
|
+
"type": "boolean",
|
|
412
|
+
"description": "Additive (1.6.6): true when the finding was classified as vendored/third-party code (DSC-16 C-16.1). A vendor finding is WARN by default and FAIL under --strict-vendor."
|
|
409
413
|
}
|
|
410
414
|
}
|
|
411
415
|
},
|