dsh-standards 1.1.2 → 1.2.1
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/40-checker/README.md +15 -0
- package/40-checker/bin/dsh-flow-collect.mjs +3 -0
- package/40-checker/bin/dsh-levels.mjs +13 -2
- package/40-checker/scripts/bundle-smoke.mjs +3 -0
- package/40-checker/scripts/entry18-ci.mjs +4 -3
- package/40-checker/scripts/entry18-web.mjs +4 -1
- package/40-checker/scripts/flow-collect.mjs +494 -0
- package/40-checker/scripts/flow-sample-ci.mjs +4 -4
- package/40-checker/scripts/host-farm.mjs +2 -1
- package/40-checker/scripts/journey-config-observe.mjs +5 -3
- package/40-checker/scripts/journey-runtime.mjs +208 -83
- package/40-checker/scripts/level-audit.mjs +119 -19
- package/40-checker/scripts/m2-runner.mjs +4 -3
- package/40-checker/scripts/runtime-child.mjs +4 -0
- package/40-checker/src/cli.mjs +10 -2
- package/40-checker/src/flow-evidence.mjs +455 -0
- package/40-checker/src/index.mjs +3 -0
- package/40-checker/src/remediation.mjs +137 -0
- package/40-checker/src/report.mjs +19 -2
- package/40-checker/src/sandbox-env.mjs +78 -0
- package/CHANGELOG.md +22 -0
- package/bin/dsh-flow-collect.mjs +4 -0
- package/package.json +1 -2
- package/spec/README.md +2 -0
- package/spec/flow/README.md +27 -2
- package/spec/flow-evidence.schema.json +221 -0
- package/spec/levels.json +2 -0
- package/spec/remediation.json +478 -0
- package/40-checker/test/attestation.test.mjs +0 -59
- package/40-checker/test/checks.test.mjs +0 -414
- package/40-checker/test/claim.test.mjs +0 -28
- package/40-checker/test/client-shape.test.mjs +0 -35
- package/40-checker/test/dco.test.mjs +0 -51
- package/40-checker/test/entry-validate.test.mjs +0 -172
- package/40-checker/test/governance.test.mjs +0 -76
- package/40-checker/test/label.test.mjs +0 -97
- package/40-checker/test/level-audit.test.mjs +0 -99
- package/40-checker/test/levels.test.mjs +0 -31
- package/40-checker/test/ops.test.mjs +0 -117
- package/40-checker/test/permissions.test.mjs +0 -40
- package/40-checker/test/semver.test.mjs +0 -32
- package/40-checker/test/verify.test.mjs +0 -57
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import test from 'node:test'
|
|
2
|
-
import assert from 'node:assert/strict'
|
|
3
|
-
import fs from 'node:fs'
|
|
4
|
-
import os from 'node:os'
|
|
5
|
-
import path from 'node:path'
|
|
6
|
-
import { fileURLToPath } from 'node:url'
|
|
7
|
-
import { buildIndex, findAttestation, effectiveStatus, summarize, verify } from '../../publish/verify.mjs'
|
|
8
|
-
|
|
9
|
-
const HERE = path.dirname(fileURLToPath(import.meta.url))
|
|
10
|
-
const ROOT = path.resolve(HERE, '..', '..')
|
|
11
|
-
|
|
12
|
-
test('verify: the index contains the example record', () => {
|
|
13
|
-
const index = buildIndex(path.join(ROOT, 'publish/attestations'))
|
|
14
|
-
assert.equal(index.schema, 'dsh-attestation-index/1')
|
|
15
|
-
const entry = findAttestation(index, 'DSH-ATT-2026-001')
|
|
16
|
-
assert.ok(entry)
|
|
17
|
-
assert.equal(entry.grade, 'A')
|
|
18
|
-
assert.equal(entry.claimLevel, 'self-reported')
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
test('verify: an unknown ID is not found', () => {
|
|
22
|
-
const index = buildIndex(path.join(ROOT, 'publish/attestations'))
|
|
23
|
-
assert.equal(findAttestation(index, 'DSH-ATT-1999-999'), null)
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
test('verify: an expired active record is reported expired', () => {
|
|
27
|
-
const cert = { status: 'active', expiresAt: '2020-01-01' }
|
|
28
|
-
assert.equal(effectiveStatus(cert, new Date('2026-11-01T00:00:00Z')), 'expired')
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
test('verify: a non-active status is preserved', () => {
|
|
32
|
-
assert.equal(effectiveStatus({ status: 'withdrawn', expiresAt: '2030-01-01' }), 'withdrawn')
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
test('verify: the example record validates', async () => {
|
|
36
|
-
const result = await verify({ root: ROOT, id: 'DSH-ATT-2026-001' })
|
|
37
|
-
assert.equal(result.ok, true)
|
|
38
|
-
assert.equal(result.attestation.claimLevel, 'self-reported')
|
|
39
|
-
assert.equal(result.attestation.selfAssessed, true)
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
test('verify: an invalid file fails', async () => {
|
|
43
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'dsh-verify-cert-'))
|
|
44
|
-
const file = path.join(dir, 'bad.json')
|
|
45
|
-
fs.writeFileSync(file, JSON.stringify({ schema: 'dsh-attestation/1', attestationId: 'bad' }))
|
|
46
|
-
const result = await verify({ root: ROOT, file })
|
|
47
|
-
assert.equal(result.ok, false)
|
|
48
|
-
assert.ok(result.errors.length > 0)
|
|
49
|
-
fs.rmSync(dir, { recursive: true, force: true })
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
test('verify: summarize keeps the disclaimer and evidence', () => {
|
|
53
|
-
const cert = JSON.parse(fs.readFileSync(path.join(ROOT, 'publish/attestations/DSH-ATT-2026-001.json'), 'utf8'))
|
|
54
|
-
const s = summarize(cert)
|
|
55
|
-
assert.match(s.disclaimer, /非官方/)
|
|
56
|
-
assert.equal(s.evidence.length, 5)
|
|
57
|
-
})
|