dsh-standards 1.6.12 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/31-DS-C/346/235/241/346/254/276.md +3 -1
- package/31-DSH-ENTRY/345/205/245/351/227/250/350/247/204/350/214/203.md +0 -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 +0 -0
- package/40-checker/README.md +0 -0
- package/40-checker/bin/dsh-flow-collect.mjs +0 -0
- package/40-checker/bin/dsh-plugin-verify.mjs +0 -0
- package/40-checker/fixtures/bad/index.mjs +0 -0
- package/40-checker/fixtures/bad/package.json +0 -0
- package/40-checker/fixtures/bad-manifest/index.js +0 -0
- package/40-checker/fixtures/bad-manifest/package.json +0 -0
- package/40-checker/fixtures/bundle/cordis.patch.yml +0 -0
- package/40-checker/fixtures/bundle/package.json +0 -0
- package/40-checker/fixtures/bundle/server.mjs +0 -0
- package/40-checker/fixtures/bundle-patch-only/cordis.patch.yml +0 -0
- package/40-checker/fixtures/bundle-patch-only/package.json +0 -0
- package/40-checker/fixtures/bundle-v0/cordis.patch.yml +0 -0
- package/40-checker/fixtures/bundle-v0/package.json +0 -0
- package/40-checker/fixtures/bundle-v0/server.mjs +0 -0
- package/40-checker/fixtures/c12-command-arg/index.mjs +0 -0
- package/40-checker/fixtures/c12-command-arg/package.json +0 -0
- package/40-checker/fixtures/c12-comment/index.mjs +0 -0
- package/40-checker/fixtures/c12-comment/package.json +0 -0
- package/40-checker/fixtures/c12-compare/index.mjs +0 -0
- package/40-checker/fixtures/c12-compare/package.json +0 -0
- package/40-checker/fixtures/c12-doc-string/index.mjs +0 -0
- package/40-checker/fixtures/c12-doc-string/package.json +0 -0
- package/40-checker/fixtures/c12-grant/index.mjs +0 -0
- package/40-checker/fixtures/c12-grant/package.json +0 -0
- package/40-checker/fixtures/c12-string/index.mjs +0 -0
- package/40-checker/fixtures/c12-string/package.json +0 -0
- package/40-checker/fixtures/client-missing/client.js +0 -0
- package/40-checker/fixtures/client-missing/index.js +0 -0
- package/40-checker/fixtures/client-missing/package.json +0 -0
- package/40-checker/fixtures/declaration-file/index.d.ts +0 -0
- package/40-checker/fixtures/declaration-file/index.mjs +0 -0
- package/40-checker/fixtures/declaration-file/package.json +0 -0
- package/40-checker/fixtures/flow-config/index.js +0 -0
- package/40-checker/fixtures/flow-config/package.json +0 -0
- package/40-checker/fixtures/fs-write/index.mjs +0 -0
- package/40-checker/fixtures/fs-write/package.json +0 -0
- package/40-checker/fixtures/good/index.mjs +0 -0
- package/40-checker/fixtures/good/package.json +0 -0
- package/40-checker/fixtures/hang/index.mjs +0 -0
- package/40-checker/fixtures/hang/package.json +0 -0
- package/40-checker/fixtures/import-local-side-effect/index.mjs +0 -0
- package/40-checker/fixtures/import-local-side-effect/package.json +0 -0
- package/40-checker/fixtures/import-local-side-effect/side-effectful.mjs +0 -0
- package/40-checker/fixtures/import-open-readonly/index.mjs +0 -0
- package/40-checker/fixtures/import-open-readonly/package.json +0 -0
- package/40-checker/fixtures/import-package-only/index.mjs +0 -0
- package/40-checker/fixtures/import-package-only/package.json +0 -0
- package/40-checker/fixtures/import-parse-error/index.mjs +0 -0
- package/40-checker/fixtures/import-parse-error/package.json +0 -0
- package/40-checker/fixtures/import-side-effect/index.mjs +0 -0
- package/40-checker/fixtures/import-side-effect/package.json +0 -0
- package/40-checker/fixtures/import-side-effect-nonentry/index.mjs +0 -0
- package/40-checker/fixtures/import-side-effect-nonentry/package.json +0 -0
- package/40-checker/fixtures/import-side-effect-nonentry/selfcheck.mjs +0 -0
- package/40-checker/fixtures/import-void-main/index.mjs +0 -0
- package/40-checker/fixtures/import-void-main/package.json +0 -0
- package/40-checker/fixtures/known-answer/expected.json +0 -0
- package/40-checker/fixtures/market-index-real.json +0 -0
- package/40-checker/fixtures/market-index.json +0 -0
- package/40-checker/fixtures/negative/bad-entry/package.json +0 -0
- package/40-checker/fixtures/negative/no-entry/package.json +0 -0
- package/40-checker/fixtures/negative/no-patch/package.json +0 -0
- package/40-checker/fixtures/negative/root-missing/cordis.patch.yml +0 -0
- package/40-checker/fixtures/negative/root-missing/package.json +0 -0
- package/40-checker/fixtures/negative/workspace/package.json +0 -0
- package/40-checker/fixtures/no-source/package.json +0 -0
- package/40-checker/fixtures/parse-error-nonentry/index.mjs +0 -0
- package/40-checker/fixtures/parse-error-nonentry/package.json +0 -0
- package/40-checker/fixtures/parse-error-nonentry/references/broken.js +0 -0
- package/40-checker/fixtures/security/sec11-cred-declared/index.mjs +0 -0
- package/40-checker/fixtures/security/sec11-cred-declared/package.json +0 -0
- package/40-checker/fixtures/security/sec11-cred-list/index.mjs +0 -0
- package/40-checker/fixtures/security/sec11-cred-list/package.json +0 -0
- package/40-checker/fixtures/security/sec11-cred-undeclared/index.mjs +0 -0
- package/40-checker/fixtures/security/sec11-cred-undeclared/package.json +0 -0
- package/40-checker/fixtures/security/sec15-clean/index.mjs +0 -0
- package/40-checker/fixtures/security/sec15-clean/package.json +0 -0
- package/40-checker/fixtures/security/sec15-install-cred/index.mjs +0 -0
- package/40-checker/fixtures/security/sec15-install-cred/install.js +0 -0
- package/40-checker/fixtures/security/sec15-install-cred/package.json +0 -0
- package/40-checker/fixtures/security/sec15-install-curl/index.mjs +0 -0
- package/40-checker/fixtures/security/sec15-install-curl/package.json +0 -0
- package/40-checker/fixtures/security/sec15-install-curl/scripts/install.sh +0 -0
- package/40-checker/fixtures/security/sec15-install-danger/index.mjs +0 -0
- package/40-checker/fixtures/security/sec15-install-danger/install.js +0 -0
- package/40-checker/fixtures/security/sec15-install-danger/package.json +0 -0
- package/40-checker/fixtures/security/sec15-install-download-safe/index.js +0 -0
- package/40-checker/fixtures/security/sec15-install-download-safe/package.json +0 -0
- package/40-checker/fixtures/security/sec15-install-download-safe/scripts/install.js +0 -0
- package/40-checker/fixtures/security/sec15-install-download-safe/scripts/local-util.cjs +0 -0
- package/40-checker/fixtures/security/sec15-install-dynamic/index.js +0 -0
- package/40-checker/fixtures/security/sec15-install-dynamic/package.json +0 -0
- package/40-checker/fixtures/security/sec15-install-dynamic/scripts/install.js +0 -0
- package/40-checker/fixtures/security/sec15-install-remote-literal/index.js +0 -0
- package/40-checker/fixtures/security/sec15-install-remote-literal/package.json +0 -0
- package/40-checker/fixtures/security/sec15-install-remote-literal/scripts/install.js +0 -0
- package/40-checker/fixtures/security/sec15-install-safe/index.mjs +0 -0
- package/40-checker/fixtures/security/sec15-install-safe/install.js +0 -0
- package/40-checker/fixtures/security/sec15-install-safe/package.json +0 -0
- package/40-checker/fixtures/security/sec15-missing-ref/index.mjs +0 -0
- package/40-checker/fixtures/security/sec15-missing-ref/package.json +0 -0
- package/40-checker/fixtures/security/sec15-node/index.mjs +0 -0
- package/40-checker/fixtures/security/sec15-node/package.json +0 -0
- package/40-checker/fixtures/security/sec15-node/scripts/build.mjs +0 -0
- package/40-checker/fixtures/security/sec15-pipe/index.mjs +0 -0
- package/40-checker/fixtures/security/sec15-pipe/package.json +0 -0
- package/40-checker/fixtures/security/sec16-base64-clean/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-base64-clean/package.json +0 -0
- package/40-checker/fixtures/security/sec16-base64-eval/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-base64-eval/package.json +0 -0
- package/40-checker/fixtures/security/sec16-client/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-client/lib/client.js +0 -0
- package/40-checker/fixtures/security/sec16-client/package.json +0 -0
- package/40-checker/fixtures/security/sec16-declared/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-declared/package.json +0 -0
- package/40-checker/fixtures/security/sec16-eval/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-eval/package.json +0 -0
- package/40-checker/fixtures/security/sec16-exec-curl/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-exec-curl/package.json +0 -0
- package/40-checker/fixtures/security/sec16-import-only/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-import-only/package.json +0 -0
- package/40-checker/fixtures/security/sec16-require/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-require/package.json +0 -0
- package/40-checker/fixtures/security/sec16-spawn-shell/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-spawn-shell/package.json +0 -0
- package/40-checker/fixtures/security/sec16-subprocess-safe/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-subprocess-safe/package.json +0 -0
- package/40-checker/fixtures/security/sec16-vendor-bundle/lib/index.js +0 -0
- package/40-checker/fixtures/security/sec16-vendor-bundle/package.json +0 -0
- package/40-checker/fixtures/security/sec16-vendor-decoy/lib/index.js +0 -0
- package/40-checker/fixtures/security/sec16-vendor-decoy/package.json +0 -0
- package/40-checker/fixtures/security/sec16-vendor-path/index.mjs +0 -0
- package/40-checker/fixtures/security/sec16-vendor-path/package.json +0 -0
- package/40-checker/fixtures/security/sec16-vendor-path/vendor/schemastery.mjs +0 -0
- package/40-checker/fixtures/security/sec17-alias-clean/data.txt +0 -0
- package/40-checker/fixtures/security/sec17-alias-clean/index.mjs +0 -0
- package/40-checker/fixtures/security/sec17-alias-clean/package.json +0 -0
- package/40-checker/fixtures/security/sec17-alias-read/index.mjs +0 -0
- package/40-checker/fixtures/security/sec17-alias-read/package.json +0 -0
- package/40-checker/fixtures/security/sec17-base64-path/index.mjs +0 -0
- package/40-checker/fixtures/security/sec17-base64-path/package.json +0 -0
- package/40-checker/fixtures/security/sec17-base64-path-clean/data/config.json +0 -0
- package/40-checker/fixtures/security/sec17-base64-path-clean/index.mjs +0 -0
- package/40-checker/fixtures/security/sec17-base64-path-clean/package.json +0 -0
- package/40-checker/fixtures/security/sec17-cred-exfil/index.mjs +0 -0
- package/40-checker/fixtures/security/sec17-cred-exfil/package.json +0 -0
- package/40-checker/fixtures/security/sec17-env/index.mjs +0 -0
- package/40-checker/fixtures/security/sec17-env/package.json +0 -0
- package/40-checker/fixtures/security/sec17-home-env/index.js +0 -0
- package/40-checker/fixtures/security/sec17-home-env/package.json +0 -0
- package/40-checker/fixtures/security/sec17-home-env-clean/index.mjs +0 -0
- package/40-checker/fixtures/security/sec17-home-env-clean/package.json +0 -0
- package/40-checker/fixtures/security/sec17-seam/index.mjs +0 -0
- package/40-checker/fixtures/security/sec17-seam/package.json +0 -0
- package/40-checker/fixtures/security/sec17-ssh/index.mjs +0 -0
- package/40-checker/fixtures/security/sec17-ssh/package.json +0 -0
- package/40-checker/fixtures/security/sec18-bad/index.mjs +0 -0
- package/40-checker/fixtures/security/sec18-bad/package.json +0 -0
- package/40-checker/fixtures/security/sec18-good/index.mjs +0 -0
- package/40-checker/fixtures/security/sec18-good/package.json +0 -0
- package/40-checker/fixtures/security/sec18-split-fetch/index.mjs +0 -0
- package/40-checker/fixtures/security/sec18-split-fetch/package.json +0 -0
- package/40-checker/fixtures/security/sec18-split-fetch-clean/index.mjs +0 -0
- package/40-checker/fixtures/security/sec18-split-fetch-clean/package.json +0 -0
- package/40-checker/fixtures/security/sec18-undeclared/index.mjs +0 -0
- package/40-checker/fixtures/security/sec18-undeclared/package.json +0 -0
- package/40-checker/fixtures/security/sec19-blob/index.mjs +0 -0
- package/40-checker/fixtures/security/sec19-blob/package.json +0 -0
- package/40-checker/fixtures/security/sec19-clean/index.mjs +0 -0
- package/40-checker/fixtures/security/sec19-clean/package.json +0 -0
- package/40-checker/fixtures/security/sec19-wasm/blob.wasm +0 -0
- package/40-checker/fixtures/security/sec19-wasm/index.mjs +0 -0
- package/40-checker/fixtures/security/sec19-wasm/package.json +0 -0
- package/40-checker/fixtures/security/sec20-unwrapped/index.mjs +0 -0
- package/40-checker/fixtures/security/sec20-unwrapped/package.json +0 -0
- package/40-checker/fixtures/security/sec20-wrapped/index.mjs +0 -0
- package/40-checker/fixtures/security/sec20-wrapped/package.json +0 -0
- package/40-checker/fixtures/security/sec21-known/index.mjs +0 -0
- package/40-checker/fixtures/security/sec21-known/package.json +0 -0
- package/40-checker/fixtures/security/sec21-typosquat/index.mjs +0 -0
- package/40-checker/fixtures/security/sec21-typosquat/package.json +0 -0
- package/40-checker/fixtures/security/sec22-attested/index.mjs +0 -0
- package/40-checker/fixtures/security/sec22-attested/package.json +0 -0
- package/40-checker/fixtures/security/sec22-none/index.mjs +0 -0
- package/40-checker/fixtures/security/sec22-none/package.json +0 -0
- package/40-checker/package.json +0 -0
- package/40-checker/samples/README.md +0 -0
- package/40-checker/samples/entry18.json +0 -0
- package/40-checker/samples/frame.json +0 -0
- package/40-checker/scripts/apply-overlay.mjs +0 -0
- package/40-checker/scripts/attestation-check.mjs +0 -0
- package/40-checker/scripts/build-offline-kit.mjs +0 -0
- package/40-checker/scripts/build-sidecar.mjs +0 -0
- package/40-checker/scripts/bundle-smoke.mjs +0 -0
- package/40-checker/scripts/claim-check.mjs +0 -0
- package/40-checker/scripts/clause-map.mjs +0 -0
- package/40-checker/scripts/collect-fixtures.mjs +0 -0
- package/40-checker/scripts/dashboard.mjs +0 -0
- package/40-checker/scripts/dco-check.mjs +0 -0
- package/40-checker/scripts/dependabot-check.mjs +0 -0
- package/40-checker/scripts/doc-commands-check.mjs +0 -0
- package/40-checker/scripts/entry-scan.mjs +0 -0
- package/40-checker/scripts/entry-validate.mjs +0 -0
- package/40-checker/scripts/entry18-attribution.mjs +0 -0
- package/40-checker/scripts/entry18-ci.mjs +0 -0
- package/40-checker/scripts/entry18-realweb-summary.mjs +0 -0
- package/40-checker/scripts/entry18-web.mjs +0 -0
- package/40-checker/scripts/evidence-chain.mjs +0 -0
- package/40-checker/scripts/flow-collect.mjs +0 -0
- package/40-checker/scripts/flow-index.mjs +0 -0
- package/40-checker/scripts/flow-sample-ci.mjs +0 -0
- package/40-checker/scripts/governance-check.mjs +0 -0
- package/40-checker/scripts/host-farm.mjs +0 -0
- package/40-checker/scripts/journey-config-observe.mjs +0 -0
- package/40-checker/scripts/journey-disclosure-shape.mjs +0 -0
- package/40-checker/scripts/journey-runtime.mjs +0 -0
- package/40-checker/scripts/journey.mjs +0 -0
- package/40-checker/scripts/label-drift.mjs +0 -0
- package/40-checker/scripts/label-sync.mjs +0 -0
- package/40-checker/scripts/label-verify.mjs +0 -0
- package/40-checker/scripts/land-runtime-artifacts.mjs +0 -0
- package/40-checker/scripts/landlock-exec.c +0 -0
- package/40-checker/scripts/level-audit.mjs +0 -0
- package/40-checker/scripts/m1-sidecar.mjs +0 -0
- package/40-checker/scripts/m2-runner.mjs +0 -0
- package/40-checker/scripts/repo-anchor-check.mjs +0 -0
- package/40-checker/scripts/round-robin.mjs +0 -0
- package/40-checker/scripts/run-tests.mjs +0 -0
- package/40-checker/scripts/runtime-child.mjs +0 -0
- package/40-checker/scripts/sample-frame.mjs +0 -0
- package/40-checker/scripts/sample20-ci.mjs +0 -0
- package/40-checker/scripts/sample60-ci.mjs +0 -0
- package/40-checker/scripts/sign-evidence.mjs +0 -0
- package/40-checker/scripts/stale-check.mjs +0 -0
- package/40-checker/scripts/surveillance.mjs +0 -0
- package/40-checker/scripts/web-probe.mjs +0 -0
- package/40-checker/src/author-cli.mjs +0 -0
- package/40-checker/src/author-report.mjs +0 -0
- package/40-checker/src/bundle-static.mjs +0 -0
- package/40-checker/src/cli.mjs +0 -0
- package/40-checker/src/client-shape.mjs +0 -0
- package/40-checker/src/declarations.mjs +2 -1
- package/40-checker/src/flow-evidence.mjs +0 -0
- package/40-checker/src/index.mjs +0 -0
- package/40-checker/src/install-spec.mjs +0 -0
- package/40-checker/src/label.mjs +0 -0
- package/40-checker/src/manifest.mjs +0 -0
- package/40-checker/src/npm-command.mjs +0 -0
- package/40-checker/src/permissions.mjs +0 -0
- package/40-checker/src/remediation.mjs +0 -0
- package/40-checker/src/report.mjs +0 -0
- package/40-checker/src/result.mjs +0 -0
- package/40-checker/src/runtime-child.mjs +0 -0
- package/40-checker/src/runtime.mjs +0 -0
- package/40-checker/src/sandbox-env.mjs +0 -0
- package/40-checker/src/sandbox-run.mjs +0 -0
- package/40-checker/src/security.mjs +0 -0
- package/40-checker/src/semver.mjs +0 -0
- package/40-checker/src/signature.mjs +0 -0
- package/40-checker/src/util.mjs +0 -0
- package/40-checker/vendor/babel/README.md +0 -0
- package/40-checker/vendor/babel/index.cjs +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-string-parser/LICENSE +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-string-parser/README.md +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-string-parser/lib/index.d.ts +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-string-parser/lib/index.js +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-string-parser/package.json +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-validator-identifier/LICENSE +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-validator-identifier/README.md +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-validator-identifier/lib/identifier-browser.js +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-validator-identifier/lib/identifier.js +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-validator-identifier/lib/index.d.ts +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-validator-identifier/lib/index.js +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/helper-validator-identifier/package.json +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/parser/CHANGELOG.md +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/parser/LICENSE +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/parser/README.md +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/parser/bin/babel-parser.js +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/parser/lib/index.d.ts +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/parser/lib/index.js +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/parser/package.json +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/parser/typings/babel-parser.d.ts +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/types/LICENSE +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/types/README.md +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/types/lib/index-legacy.d.ts +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/types/lib/index.d.ts +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/types/lib/index.js +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/types/lib/index.js.flow +0 -0
- package/40-checker/vendor/babel/node_modules/@babel/types/package.json +0 -0
- package/CHANGELOG.md +21 -0
- package/LICENSE +0 -0
- package/LICENSE-APACHE +0 -0
- package/LICENSE-CC-BY +0 -0
- package/NOTICE +0 -0
- package/NOTICE.md +0 -0
- package/README.en.md +1 -1
- package/README.es.md +1 -1
- package/README.hi.md +1 -1
- package/README.md +5 -3
- package/README.pt.md +1 -1
- package/SECURITY.md +0 -0
- package/bin/dsh-flow-collect.mjs +0 -0
- package/bin/dsh-levels.mjs +0 -0
- package/bin/dsh-standards.mjs +0 -0
- package/docs/BOOST-FIXTURES-2026-11-02.md +0 -0
- package/docs/COMPATUM.md +193 -0
- package/docs/DEVELOPER-JOURNEY.md +0 -0
- package/docs/HOST-J3-BUG-REPORT-DRAFT.md +0 -0
- package/docs/HOST-J3-CONFIG-REPRO-2026-11-02.md +0 -0
- package/docs/NAMING-FALLBACK.md +0 -0
- package/docs/SIGNING.md +0 -0
- package/docs/assets/dsh-standards-flow-dark.svg +0 -0
- package/docs/assets/dsh-standards-flow-light.svg +0 -0
- package/docs/assets/dsh-standards-flow-v3-dark.svg +0 -0
- package/docs/assets/dsh-standards-flow-v3-light.svg +0 -0
- package/docs/assets/dsh-standards-flow-v4-dark.svg +0 -0
- package/docs/assets/dsh-standards-flow-v4-light.svg +0 -0
- package/docs/assets/dsh-standards-hero-en-dark.webp +0 -0
- package/docs/assets/dsh-standards-hero-en-light.webp +0 -0
- package/docs/assets/dsh-standards-hero-zh-dark.webp +0 -0
- package/docs/assets/dsh-standards-hero-zh-light.webp +0 -0
- package/docs/coverage.md +0 -0
- package/docs/fork-policy.md +0 -0
- package/docs/full-test-plan-2026-11-02.md +0 -0
- package/docs/incident.md +0 -0
- package/docs/onboarding.md +0 -0
- package/docs/privacy.md +0 -0
- package/docs/release.md +0 -0
- package/docs/repo-anchors-rc3-2026-11-14.md +0 -0
- package/docs/scope-security.md +0 -0
- package/docs/status-taxonomy.md +0 -0
- package/docs/sunset.md +0 -0
- package/docs/translating.md +0 -0
- package/examples/compatum/mcp-profile.json +105 -0
- package/examples/compatum/permission-rules-profile.json +97 -0
- package/examples/compatum/plugin-full.json +155 -0
- package/examples/compatum/plugin-min.json +48 -0
- package/package.json +3 -1
- package/spec/README.md +3 -0
- package/spec/boost/README.md +0 -0
- package/spec/clauses.json +0 -0
- package/spec/compatum-validate.mjs +791 -0
- package/spec/compatum.schema.json +939 -0
- package/spec/coverage-contract.md +0 -0
- package/spec/dsc-clauses.json +0 -0
- package/spec/entry/README.md +0 -0
- package/spec/examples/boost-card.example.json +0 -0
- package/spec/examples/flow-evidence.example.json +0 -0
- package/spec/flow/README.md +0 -0
- package/spec/flow-evidence.schema.json +0 -0
- package/spec/levels.json +0 -0
- package/spec/levels.schema.json +0 -0
- package/spec/reference-suite.json +0 -0
- package/spec/remediation.json +1 -1
- package/spec/schemas/advice.schema.json +0 -0
- package/spec/schemas/attestation.schema.json +0 -0
- package/spec/schemas/boost-card.schema.json +0 -0
- package/spec/schemas/conformance.schema.json +0 -0
- package/spec/schemas/evidence.schema.json +0 -0
- package/spec/schemas/report.schema.json +0 -0
|
@@ -0,0 +1,791 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Zero-dependency validator for the Compatum/1 profile.
|
|
4
|
+
*
|
|
5
|
+
* It implements the JSON Schema 2020-12 subset used by
|
|
6
|
+
* spec/compatum.schema.json, then applies the profile's non-schema rules:
|
|
7
|
+
* duplicate IDs, aliases, effect consistency, stale historical evidence, and
|
|
8
|
+
* "declared evidence may not carry a checked result".
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* node spec/compatum-validate.mjs
|
|
12
|
+
* node spec/compatum-validate.mjs examples/compatum/plugin-full.json
|
|
13
|
+
* node spec/compatum-validate.mjs --json
|
|
14
|
+
*
|
|
15
|
+
* Exit code 0 means every example passed and the built-in negative self-test
|
|
16
|
+
* rejected all cases. No network, no package install, no plugin code runs.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { readFileSync, readdirSync, statSync } from 'node:fs';
|
|
20
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
21
|
+
import { fileURLToPath } from 'node:url';
|
|
22
|
+
|
|
23
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
const ROOT = resolve(HERE, '..');
|
|
25
|
+
const SCHEMA_PATH = join(HERE, 'compatum.schema.json');
|
|
26
|
+
const DEFAULT_EXAMPLES = join(ROOT, 'examples', 'compatum');
|
|
27
|
+
|
|
28
|
+
const KNOWN_FORMATS = new Set(['date', 'date-time', 'uri', 'uri-reference']);
|
|
29
|
+
|
|
30
|
+
function readJson(file) {
|
|
31
|
+
let text;
|
|
32
|
+
try {
|
|
33
|
+
text = readFileSync(file, 'utf8');
|
|
34
|
+
} catch (error) {
|
|
35
|
+
throw new Error(`cannot read ${file}: ${error.message}`);
|
|
36
|
+
}
|
|
37
|
+
if (text.charCodeAt(0) === 0xfeff) text = text.slice(1);
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(text);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
throw new Error(`invalid JSON in ${file}: ${error.message}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function isPlainObject(value) {
|
|
46
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function deepEqual(a, b) {
|
|
50
|
+
return stableStringify(a) === stableStringify(b);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function stableStringify(value) {
|
|
54
|
+
if (value === null || typeof value !== 'object') return JSON.stringify(value);
|
|
55
|
+
if (Array.isArray(value)) return `[${value.map(stableStringify).join(',')}]`;
|
|
56
|
+
const keys = Object.keys(value).sort();
|
|
57
|
+
return `{${keys.map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`).join(',')}}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function formatPath(path, segment) {
|
|
61
|
+
if (typeof segment === 'number') return `${path}[${segment}]`;
|
|
62
|
+
if (/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(segment)) return `${path}.${segment}`;
|
|
63
|
+
return `${path}[${JSON.stringify(segment)}]`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function resolveRef(root, ref) {
|
|
67
|
+
if (ref === '#') return root;
|
|
68
|
+
if (!ref.startsWith('#/')) return undefined;
|
|
69
|
+
let node = root;
|
|
70
|
+
for (const raw of ref.slice(2).split('/')) {
|
|
71
|
+
const key = raw.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
72
|
+
if (!isPlainObject(node) && !Array.isArray(node)) return undefined;
|
|
73
|
+
node = node[key];
|
|
74
|
+
if (node === undefined) return undefined;
|
|
75
|
+
}
|
|
76
|
+
return node;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function matchesType(value, type) {
|
|
80
|
+
const types = Array.isArray(type) ? type : [type];
|
|
81
|
+
return types.some((one) => {
|
|
82
|
+
switch (one) {
|
|
83
|
+
case 'object':
|
|
84
|
+
return isPlainObject(value);
|
|
85
|
+
case 'array':
|
|
86
|
+
return Array.isArray(value);
|
|
87
|
+
case 'string':
|
|
88
|
+
return typeof value === 'string';
|
|
89
|
+
case 'integer':
|
|
90
|
+
return Number.isInteger(value);
|
|
91
|
+
case 'number':
|
|
92
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
93
|
+
case 'boolean':
|
|
94
|
+
return typeof value === 'boolean';
|
|
95
|
+
case 'null':
|
|
96
|
+
return value === null;
|
|
97
|
+
default:
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function typeName(value) {
|
|
104
|
+
if (value === null) return 'null';
|
|
105
|
+
if (Array.isArray(value)) return 'array';
|
|
106
|
+
if (Number.isInteger(value)) return 'integer';
|
|
107
|
+
return typeof value;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function unicodeLength(value) {
|
|
111
|
+
return Array.from(value).length;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function isValidDate(value) {
|
|
115
|
+
if (typeof value !== 'string' || !/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value)) return false;
|
|
116
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
117
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
118
|
+
return (
|
|
119
|
+
date.getUTCFullYear() === year &&
|
|
120
|
+
date.getUTCMonth() === month - 1 &&
|
|
121
|
+
date.getUTCDate() === day
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function isValidDateTime(value) {
|
|
126
|
+
if (
|
|
127
|
+
typeof value !== 'string' ||
|
|
128
|
+
!/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]+)?(?:Z|[+-][0-9]{2}:[0-9]{2})$/.test(
|
|
129
|
+
value,
|
|
130
|
+
)
|
|
131
|
+
) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
return !Number.isNaN(Date.parse(value));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function isValidUri(value) {
|
|
138
|
+
if (typeof value !== 'string' || value.length === 0) return false;
|
|
139
|
+
try {
|
|
140
|
+
const url = new URL(value);
|
|
141
|
+
return Boolean(url.protocol);
|
|
142
|
+
} catch {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function checkFormat(format, value) {
|
|
148
|
+
if (!KNOWN_FORMATS.has(format)) return true;
|
|
149
|
+
switch (format) {
|
|
150
|
+
case 'date':
|
|
151
|
+
return isValidDate(value);
|
|
152
|
+
case 'date-time':
|
|
153
|
+
return isValidDateTime(value);
|
|
154
|
+
case 'uri':
|
|
155
|
+
return isValidUri(value);
|
|
156
|
+
case 'uri-reference':
|
|
157
|
+
return typeof value === 'string';
|
|
158
|
+
default:
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function isValidSemver(value) {
|
|
164
|
+
return (
|
|
165
|
+
typeof value === 'string' &&
|
|
166
|
+
/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(
|
|
167
|
+
value,
|
|
168
|
+
)
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function isValidSemverRange(value) {
|
|
173
|
+
if (typeof value !== 'string' || value.length === 0 || value.length > 128) return false;
|
|
174
|
+
const trim = value.trim();
|
|
175
|
+
if (trim === '*' || trim === 'x' || trim === 'X') return true;
|
|
176
|
+
return trim.split('||').every((part) => {
|
|
177
|
+
const group = part.trim();
|
|
178
|
+
if (!group) return false;
|
|
179
|
+
return group.split(/\s+/).every((token) => {
|
|
180
|
+
if (/^[xX*]$/.test(token)) return true;
|
|
181
|
+
return /^(?:[<>=^~]{0,2})v?[0-9]+(?:\.[0-9]+|\.[xX*]){0,2}(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(
|
|
182
|
+
token,
|
|
183
|
+
);
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function pushError(errors, path, message) {
|
|
189
|
+
errors.push({ path, message });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function validateSchema(schema, data, path, root, errors) {
|
|
193
|
+
if (schema === true) return;
|
|
194
|
+
if (schema === false) {
|
|
195
|
+
pushError(errors, path, 'no value is allowed here');
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (!isPlainObject(schema)) return;
|
|
199
|
+
|
|
200
|
+
if (schema.$ref !== undefined) {
|
|
201
|
+
const target = resolveRef(root, schema.$ref);
|
|
202
|
+
if (target === undefined) {
|
|
203
|
+
pushError(errors, path, `unresolved $ref ${schema.$ref}`);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
validateSchema(target, data, path, root, errors);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (schema.type !== undefined && !matchesType(data, schema.type)) {
|
|
210
|
+
pushError(
|
|
211
|
+
errors,
|
|
212
|
+
path,
|
|
213
|
+
`must be ${Array.isArray(schema.type) ? schema.type.join(' or ') : schema.type}, got ${typeName(data)}`,
|
|
214
|
+
);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (Object.prototype.hasOwnProperty.call(schema, 'const') && !deepEqual(data, schema.const)) {
|
|
219
|
+
pushError(errors, path, `must equal ${JSON.stringify(schema.const)}`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (Array.isArray(schema.enum) && !schema.enum.some((candidate) => deepEqual(data, candidate))) {
|
|
223
|
+
pushError(errors, path, `must be one of ${schema.enum.map((v) => JSON.stringify(v)).join(', ')}`);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (typeof data === 'string') {
|
|
227
|
+
if (schema.minLength !== undefined && unicodeLength(data) < schema.minLength) {
|
|
228
|
+
pushError(errors, path, `must be at least ${schema.minLength} characters`);
|
|
229
|
+
}
|
|
230
|
+
if (schema.maxLength !== undefined && unicodeLength(data) > schema.maxLength) {
|
|
231
|
+
pushError(errors, path, `must be at most ${schema.maxLength} characters`);
|
|
232
|
+
}
|
|
233
|
+
if (schema.pattern !== undefined) {
|
|
234
|
+
let regex;
|
|
235
|
+
try {
|
|
236
|
+
regex = new RegExp(schema.pattern, 'u');
|
|
237
|
+
} catch (error) {
|
|
238
|
+
pushError(errors, path, `schema pattern is invalid: ${error.message}`);
|
|
239
|
+
regex = null;
|
|
240
|
+
}
|
|
241
|
+
if (regex && !regex.test(data)) {
|
|
242
|
+
pushError(errors, path, `must match ${schema.pattern}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (schema.format !== undefined && !checkFormat(schema.format, data)) {
|
|
246
|
+
pushError(errors, path, `must be a valid ${schema.format}`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (Array.isArray(data)) {
|
|
251
|
+
if (schema.minItems !== undefined && data.length < schema.minItems) {
|
|
252
|
+
pushError(errors, path, `must contain at least ${schema.minItems} item(s)`);
|
|
253
|
+
}
|
|
254
|
+
if (schema.maxItems !== undefined && data.length > schema.maxItems) {
|
|
255
|
+
pushError(errors, path, `must contain at most ${schema.maxItems} item(s)`);
|
|
256
|
+
}
|
|
257
|
+
if (schema.uniqueItems === true) {
|
|
258
|
+
const seen = new Set();
|
|
259
|
+
for (let index = 0; index < data.length; index += 1) {
|
|
260
|
+
const key = stableStringify(data[index]);
|
|
261
|
+
if (seen.has(key)) {
|
|
262
|
+
pushError(errors, formatPath(path, index), 'must not contain duplicate items');
|
|
263
|
+
}
|
|
264
|
+
seen.add(key);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (schema.items !== undefined) {
|
|
268
|
+
for (let index = 0; index < data.length; index += 1) {
|
|
269
|
+
validateSchema(schema.items, data[index], formatPath(path, index), root, errors);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (Array.isArray(schema.prefixItems)) {
|
|
273
|
+
schema.prefixItems.forEach((itemSchema, index) => {
|
|
274
|
+
if (index < data.length) {
|
|
275
|
+
validateSchema(itemSchema, data[index], formatPath(path, index), root, errors);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (isPlainObject(data)) {
|
|
282
|
+
if (schema.minProperties !== undefined && Object.keys(data).length < schema.minProperties) {
|
|
283
|
+
pushError(errors, path, `must have at least ${schema.minProperties} properties`);
|
|
284
|
+
}
|
|
285
|
+
if (schema.maxProperties !== undefined && Object.keys(data).length > schema.maxProperties) {
|
|
286
|
+
pushError(errors, path, `must have at most ${schema.maxProperties} properties`);
|
|
287
|
+
}
|
|
288
|
+
if (Array.isArray(schema.required)) {
|
|
289
|
+
for (const key of schema.required) {
|
|
290
|
+
if (!Object.prototype.hasOwnProperty.call(data, key)) {
|
|
291
|
+
pushError(errors, path, `missing required property "${key}"`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (Array.isArray(schema.dependentRequired)) {
|
|
296
|
+
for (const [key, requiredKeys] of Object.entries(schema.dependentRequired)) {
|
|
297
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
298
|
+
for (const requiredKey of requiredKeys) {
|
|
299
|
+
if (!Object.prototype.hasOwnProperty.call(data, requiredKey)) {
|
|
300
|
+
pushError(errors, path, `property "${key}" requires "${requiredKey}"`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const properties = isPlainObject(schema.properties) ? schema.properties : {};
|
|
308
|
+
const patternProperties = isPlainObject(schema.patternProperties) ? schema.patternProperties : {};
|
|
309
|
+
const matched = new Set();
|
|
310
|
+
|
|
311
|
+
for (const [key, propertySchema] of Object.entries(properties)) {
|
|
312
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
313
|
+
matched.add(key);
|
|
314
|
+
validateSchema(propertySchema, data[key], formatPath(path, key), root, errors);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
for (const [pattern, propertySchema] of Object.entries(patternProperties)) {
|
|
318
|
+
let regex;
|
|
319
|
+
try {
|
|
320
|
+
regex = new RegExp(pattern, 'u');
|
|
321
|
+
} catch {
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
for (const key of Object.keys(data)) {
|
|
325
|
+
if (regex.test(key)) {
|
|
326
|
+
matched.add(key);
|
|
327
|
+
validateSchema(propertySchema, data[key], formatPath(path, key), root, errors);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
if (schema.additionalProperties === false) {
|
|
332
|
+
for (const key of Object.keys(data)) {
|
|
333
|
+
if (!matched.has(key)) {
|
|
334
|
+
pushError(errors, formatPath(path, key), 'additional property is not allowed');
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
} else if (isPlainObject(schema.additionalProperties)) {
|
|
338
|
+
for (const key of Object.keys(data)) {
|
|
339
|
+
if (!matched.has(key)) {
|
|
340
|
+
validateSchema(schema.additionalProperties, data[key], formatPath(path, key), root, errors);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (Array.isArray(schema.allOf)) {
|
|
347
|
+
for (const subSchema of schema.allOf) {
|
|
348
|
+
validateSchema(subSchema, data, path, root, errors);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (Array.isArray(schema.anyOf)) {
|
|
353
|
+
let anyValid = false;
|
|
354
|
+
for (const subSchema of schema.anyOf) {
|
|
355
|
+
if (isValidAgainst(subSchema, data, path, root)) {
|
|
356
|
+
anyValid = true;
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (!anyValid) {
|
|
361
|
+
pushError(errors, path, `must match at least one of ${schema.anyOf.length} alternatives`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (Array.isArray(schema.oneOf)) {
|
|
366
|
+
let validCount = 0;
|
|
367
|
+
for (const subSchema of schema.oneOf) {
|
|
368
|
+
if (isValidAgainst(subSchema, data, path, root)) validCount += 1;
|
|
369
|
+
}
|
|
370
|
+
if (validCount !== 1) {
|
|
371
|
+
pushError(errors, path, `must match exactly one of ${schema.oneOf.length} alternatives (matched ${validCount})`);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (schema.not !== undefined && isValidAgainst(schema.not, data, path, root)) {
|
|
376
|
+
pushError(errors, path, 'must not match the disallowed schema');
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (schema.if !== undefined) {
|
|
380
|
+
const branch = isValidAgainst(schema.if, data, path, root) ? schema.then : schema.else;
|
|
381
|
+
if (branch !== undefined) validateSchema(branch, data, path, root, errors);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function isValidAgainst(schema, data, path, root) {
|
|
386
|
+
const errors = [];
|
|
387
|
+
validateSchema(schema, data, path, root, errors);
|
|
388
|
+
return errors.length === 0;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function checkRegistry(schema) {
|
|
392
|
+
const errors = [];
|
|
393
|
+
const registry = schema?.$defs?.capabilityRegistry?.const;
|
|
394
|
+
const aliases = schema?.$defs?.capabilityAliases?.const;
|
|
395
|
+
const effects = schema?.$defs?.capabilityEffects?.const;
|
|
396
|
+
const idEnum = schema?.$defs?.capability?.properties?.id?.enum;
|
|
397
|
+
|
|
398
|
+
if (!Array.isArray(registry) || registry.length !== 16) {
|
|
399
|
+
errors.push({ path: '$.$defs.capabilityRegistry', message: 'must contain exactly 16 IDs' });
|
|
400
|
+
} else if (new Set(registry).size !== registry.length) {
|
|
401
|
+
errors.push({ path: '$.$defs.capabilityRegistry', message: 'must not contain duplicate IDs' });
|
|
402
|
+
}
|
|
403
|
+
if (!isPlainObject(aliases)) {
|
|
404
|
+
errors.push({ path: '$.$defs.capabilityAliases', message: 'must be an alias object' });
|
|
405
|
+
} else {
|
|
406
|
+
for (const [alias, target] of Object.entries(aliases)) {
|
|
407
|
+
if (registry?.includes(alias)) {
|
|
408
|
+
errors.push({ path: '$.$defs.capabilityAliases', message: `alias "${alias}" must not be a canonical ID` });
|
|
409
|
+
}
|
|
410
|
+
if (!registry?.includes(target)) {
|
|
411
|
+
errors.push({
|
|
412
|
+
path: '$.$defs.capabilityAliases',
|
|
413
|
+
message: `alias "${alias}" points at unknown ID "${target}"`,
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (!isPlainObject(effects) || !Array.isArray(registry)) {
|
|
419
|
+
errors.push({ path: '$.$defs.capabilityEffects', message: 'must map every registry ID to an effect' });
|
|
420
|
+
} else {
|
|
421
|
+
for (const id of registry) {
|
|
422
|
+
if (!['read', 'write', 'exec', 'network', 'credential', 'control'].includes(effects[id])) {
|
|
423
|
+
errors.push({ path: '$.$defs.capabilityEffects', message: `missing or invalid effect for "${id}"` });
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (!Array.isArray(idEnum)) {
|
|
428
|
+
errors.push({ path: '$.$defs.capability.properties.id.enum', message: 'must be an array' });
|
|
429
|
+
} else {
|
|
430
|
+
const canonical = new Set(registry ?? []);
|
|
431
|
+
for (const id of idEnum) {
|
|
432
|
+
if (!canonical.has(id)) {
|
|
433
|
+
errors.push({
|
|
434
|
+
path: '$.$defs.capability.properties.id.enum',
|
|
435
|
+
message: `"${id}" is in the schema enum but not the registry`,
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
for (const id of canonical) {
|
|
440
|
+
if (!idEnum.includes(id)) {
|
|
441
|
+
errors.push({
|
|
442
|
+
path: '$.$defs.capability.properties.id.enum',
|
|
443
|
+
message: `registry ID "${id}" is missing from the schema enum`,
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return errors;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const SECRET_PATTERNS = [
|
|
452
|
+
/gh[pousr]_[A-Za-z0-9]{20,}/,
|
|
453
|
+
/github_pat_[A-Za-z0-9_]{20,}/,
|
|
454
|
+
/sk-[A-Za-z0-9]{20,}/,
|
|
455
|
+
/AKIA[0-9A-Z]{16}/,
|
|
456
|
+
];
|
|
457
|
+
|
|
458
|
+
function checkDocument(document, schema) {
|
|
459
|
+
const errors = [];
|
|
460
|
+
const warnings = [];
|
|
461
|
+
const aliases = schema?.$defs?.capabilityAliases?.const ?? {};
|
|
462
|
+
const effects = schema?.$defs?.capabilityEffects?.const ?? {};
|
|
463
|
+
|
|
464
|
+
if (Array.isArray(document.capabilities) && document.capabilities.length === 0) {
|
|
465
|
+
warnings.push('capabilities is empty: explicit none, still WARN with risk unknown, never PASS');
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
const seen = new Set();
|
|
469
|
+
if (Array.isArray(document.capabilities)) {
|
|
470
|
+
document.capabilities.forEach((capability, index) => {
|
|
471
|
+
if (!isPlainObject(capability)) return;
|
|
472
|
+
const id = capability.id;
|
|
473
|
+
if (typeof id === 'string') {
|
|
474
|
+
if (Object.prototype.hasOwnProperty.call(aliases, id)) {
|
|
475
|
+
errors.push({
|
|
476
|
+
path: formatPath(formatPath('$.capabilities', index), 'id'),
|
|
477
|
+
message: `alias "${id}" must be normalized to "${aliases[id]}" and not written`,
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
if (seen.has(id)) {
|
|
481
|
+
errors.push({
|
|
482
|
+
path: formatPath(formatPath('$.capabilities', index), 'id'),
|
|
483
|
+
message: `duplicate capability id "${id}"`,
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
seen.add(id);
|
|
487
|
+
if (
|
|
488
|
+
capability.effect !== undefined &&
|
|
489
|
+
Object.prototype.hasOwnProperty.call(effects, id) &&
|
|
490
|
+
capability.effect !== effects[id]
|
|
491
|
+
) {
|
|
492
|
+
errors.push({
|
|
493
|
+
path: formatPath(formatPath('$.capabilities', index), 'effect'),
|
|
494
|
+
message: `effect for "${id}" must be "${effects[id]}", got "${capability.effect}"`,
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (Array.isArray(capability.targets)) {
|
|
499
|
+
capability.targets.forEach((target, targetIndex) => {
|
|
500
|
+
if (typeof target === 'string' && SECRET_PATTERNS.some((pattern) => pattern.test(target))) {
|
|
501
|
+
errors.push({
|
|
502
|
+
path: formatPath(formatPath(formatPath('$.capabilities', index), 'targets'), targetIndex),
|
|
503
|
+
message: 'target looks like a secret; declarations must not contain credentials',
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (Array.isArray(document.evidence)) {
|
|
512
|
+
document.evidence.forEach((record, index) => {
|
|
513
|
+
if (!isPlainObject(record)) return;
|
|
514
|
+
const base = formatPath('$.evidence', index);
|
|
515
|
+
if (record.subject && typeof record.subject.version === 'string' && record.subject.version !== document.version) {
|
|
516
|
+
if (record.stale !== true) {
|
|
517
|
+
errors.push({
|
|
518
|
+
path: `${base}.stale`,
|
|
519
|
+
message: `subject version ${record.subject.version} differs from profile version ${document.version}; historical evidence must set stale:true`,
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (
|
|
524
|
+
record.subject &&
|
|
525
|
+
typeof record.subject.name === 'string' &&
|
|
526
|
+
typeof document.name === 'string' &&
|
|
527
|
+
record.subject.name !== document.name
|
|
528
|
+
) {
|
|
529
|
+
errors.push({
|
|
530
|
+
path: `${base}.subject.name`,
|
|
531
|
+
message: `subject name "${record.subject.name}" does not match profile name "${document.name}"`,
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
if (record.level === 'declared' && (record.result === 'PASS' || record.result === 'WARN')) {
|
|
535
|
+
errors.push({
|
|
536
|
+
path: `${base}.result`,
|
|
537
|
+
message: `declared evidence cannot carry a ${record.result} result; use checked or tested`,
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
if (record.result === 'NOT-RUN') {
|
|
541
|
+
warnings.push(`evidence[${index}] result is NOT-RUN; it is preserved as not a pass`);
|
|
542
|
+
}
|
|
543
|
+
if (record.stale === true) {
|
|
544
|
+
warnings.push(`evidence[${index}] is marked stale; consumers must not treat it as current`);
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (isPlainObject(document.requires)) {
|
|
550
|
+
for (const key of ['dsh', 'node', 'claude-code', 'codex']) {
|
|
551
|
+
const range = document.requires[key];
|
|
552
|
+
if (range !== undefined && !isValidSemverRange(range)) {
|
|
553
|
+
errors.push({
|
|
554
|
+
path: `$.requires.${key}`,
|
|
555
|
+
message: `"${range}" is not a readable SemVer range`,
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (isPlainObject(document.requires.install)) {
|
|
560
|
+
const { unit, uninstall } = document.requires.install;
|
|
561
|
+
if (unit === 'server' && uninstall?.removesData === true) {
|
|
562
|
+
warnings.push('server unit declares removesData:true; server-owned data is normally retained');
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
return { errors, warnings };
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
function clone(value) {
|
|
571
|
+
return JSON.parse(JSON.stringify(value));
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function runSelfTest(schema, validDocument) {
|
|
575
|
+
const cases = [
|
|
576
|
+
{
|
|
577
|
+
name: 'alias id is rejected',
|
|
578
|
+
document: (() => {
|
|
579
|
+
const doc = clone(validDocument);
|
|
580
|
+
doc.capabilities[0].id = 'listen';
|
|
581
|
+
doc.capabilities[0].effect = 'network';
|
|
582
|
+
return doc;
|
|
583
|
+
})(),
|
|
584
|
+
expect: 'listen',
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
name: 'duplicate id is rejected',
|
|
588
|
+
document: (() => {
|
|
589
|
+
const doc = clone(validDocument);
|
|
590
|
+
doc.capabilities.push(clone(doc.capabilities[0]));
|
|
591
|
+
return doc;
|
|
592
|
+
})(),
|
|
593
|
+
expect: 'duplicate',
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: 'effect mismatch is rejected',
|
|
597
|
+
document: (() => {
|
|
598
|
+
const doc = clone(validDocument);
|
|
599
|
+
doc.capabilities[0].effect = 'exec';
|
|
600
|
+
return doc;
|
|
601
|
+
})(),
|
|
602
|
+
expect: 'effect',
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: 'version bump without stale is rejected',
|
|
606
|
+
document: (() => {
|
|
607
|
+
const doc = clone(validDocument);
|
|
608
|
+
doc.version = '9.9.9';
|
|
609
|
+
for (const record of doc.evidence) delete record.stale;
|
|
610
|
+
return doc;
|
|
611
|
+
})(),
|
|
612
|
+
expect: 'stale',
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: 'declared PASS is rejected',
|
|
616
|
+
document: (() => {
|
|
617
|
+
const doc = clone(validDocument);
|
|
618
|
+
doc.evidence = [{ ...clone(doc.evidence[0]), level: 'declared', result: 'PASS' }];
|
|
619
|
+
return doc;
|
|
620
|
+
})(),
|
|
621
|
+
expect: 'declared',
|
|
622
|
+
},
|
|
623
|
+
];
|
|
624
|
+
|
|
625
|
+
const failures = [];
|
|
626
|
+
for (const testCase of cases) {
|
|
627
|
+
const schemaErrors = [];
|
|
628
|
+
validateSchema(schema, testCase.document, '$', schema, schemaErrors);
|
|
629
|
+
const semantic = checkDocument(testCase.document, schema);
|
|
630
|
+
const messages = [...schemaErrors, ...semantic.errors].map((error) => error.message).join(' | ');
|
|
631
|
+
if (!messages.includes(testCase.expect)) {
|
|
632
|
+
failures.push(`${testCase.name}: expected an error containing "${testCase.expect}", got: ${messages || 'no errors'}`);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return { cases: cases.length, failures };
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
function collectFiles(inputs) {
|
|
639
|
+
const files = [];
|
|
640
|
+
for (const input of inputs) {
|
|
641
|
+
const absolute = resolve(process.cwd(), input);
|
|
642
|
+
let stat;
|
|
643
|
+
try {
|
|
644
|
+
stat = statSync(absolute);
|
|
645
|
+
} catch {
|
|
646
|
+
throw new Error(`path does not exist: ${input}`);
|
|
647
|
+
}
|
|
648
|
+
if (stat.isDirectory()) {
|
|
649
|
+
for (const name of readdirSync(absolute).sort()) {
|
|
650
|
+
if (name.endsWith('.json')) files.push(join(absolute, name));
|
|
651
|
+
}
|
|
652
|
+
} else {
|
|
653
|
+
files.push(absolute);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
return files;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
function display(file) {
|
|
660
|
+
const path = relative(ROOT, file);
|
|
661
|
+
return path.startsWith('..') ? file : path;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
function main() {
|
|
665
|
+
const args = process.argv.slice(2);
|
|
666
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
667
|
+
process.stdout.write(
|
|
668
|
+
[
|
|
669
|
+
'Usage: node spec/compatum-validate.mjs [options] [file-or-directory ...]',
|
|
670
|
+
'',
|
|
671
|
+
'Validates Compatum/1 documents against spec/compatum.schema.json.',
|
|
672
|
+
'With no paths, validates examples/compatum/*.json.',
|
|
673
|
+
'',
|
|
674
|
+
'Options:',
|
|
675
|
+
' --json machine-readable output',
|
|
676
|
+
' --help this text',
|
|
677
|
+
'',
|
|
678
|
+
].join('\n'),
|
|
679
|
+
);
|
|
680
|
+
return 0;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const jsonOutput = args.includes('--json');
|
|
684
|
+
const inputs = args.filter((arg) => !arg.startsWith('--'));
|
|
685
|
+
const schema = readJson(SCHEMA_PATH);
|
|
686
|
+
const registryErrors = checkRegistry(schema);
|
|
687
|
+
if (registryErrors.length > 0) {
|
|
688
|
+
if (jsonOutput) {
|
|
689
|
+
process.stdout.write(`${JSON.stringify({ ok: false, registryErrors }, null, 2)}\n`);
|
|
690
|
+
} else {
|
|
691
|
+
process.stderr.write('FAIL schema registry\n');
|
|
692
|
+
for (const error of registryErrors) process.stderr.write(` ${error.path}: ${error.message}\n`);
|
|
693
|
+
}
|
|
694
|
+
return 1;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
let files;
|
|
698
|
+
try {
|
|
699
|
+
files = collectFiles(inputs.length > 0 ? inputs : [DEFAULT_EXAMPLES]);
|
|
700
|
+
} catch (error) {
|
|
701
|
+
process.stderr.write(`FAIL ${error.message}\n`);
|
|
702
|
+
return 1;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
const results = [];
|
|
706
|
+
let selfTest = { cases: 0, failures: [] };
|
|
707
|
+
try {
|
|
708
|
+
const seed = readJson(join(DEFAULT_EXAMPLES, 'plugin-full.json'));
|
|
709
|
+
const seedErrors = [];
|
|
710
|
+
validateSchema(schema, seed, '$', schema, seedErrors);
|
|
711
|
+
selfTest = runSelfTest(schema, seed);
|
|
712
|
+
if (seedErrors.length > 0) {
|
|
713
|
+
selfTest.failures.push(
|
|
714
|
+
`negative self-test seed is invalid: ${seedErrors.map((error) => error.message).join(' | ')}`,
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
} catch (error) {
|
|
718
|
+
selfTest = { cases: 0, failures: [`cannot load negative self-test seed: ${error.message}`] };
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
for (const file of files) {
|
|
722
|
+
const errors = [];
|
|
723
|
+
const warnings = [];
|
|
724
|
+
let document;
|
|
725
|
+
try {
|
|
726
|
+
document = readJson(file);
|
|
727
|
+
} catch (error) {
|
|
728
|
+
errors.push({ path: '$', message: error.message });
|
|
729
|
+
results.push({ file: display(file), ok: false, errors, warnings });
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
732
|
+
validateSchema(schema, document, '$', schema, errors);
|
|
733
|
+
const semantic = checkDocument(document, schema);
|
|
734
|
+
errors.push(...semantic.errors);
|
|
735
|
+
warnings.push(...semantic.warnings);
|
|
736
|
+
results.push({ file: display(file), ok: errors.length === 0, errors, warnings });
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
const ok = results.every((result) => result.ok) && selfTest.failures.length === 0;
|
|
740
|
+
|
|
741
|
+
if (jsonOutput) {
|
|
742
|
+
process.stdout.write(
|
|
743
|
+
`${JSON.stringify(
|
|
744
|
+
{
|
|
745
|
+
ok,
|
|
746
|
+
schema: display(SCHEMA_PATH),
|
|
747
|
+
registry: {
|
|
748
|
+
ids: schema.$defs.capabilityRegistry.const.length,
|
|
749
|
+
aliases: Object.keys(schema.$defs.capabilityAliases.const).length,
|
|
750
|
+
},
|
|
751
|
+
selfTest,
|
|
752
|
+
files: results,
|
|
753
|
+
},
|
|
754
|
+
null,
|
|
755
|
+
2,
|
|
756
|
+
)}\n`,
|
|
757
|
+
);
|
|
758
|
+
return ok ? 0 : 1;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
process.stdout.write('Compatum/1 schema validator (zero-dependency)\n');
|
|
762
|
+
process.stdout.write(`schema: ${display(SCHEMA_PATH)}\n`);
|
|
763
|
+
process.stdout.write(
|
|
764
|
+
`registry: ${schema.$defs.capabilityRegistry.const.length} IDs, ` +
|
|
765
|
+
`${Object.keys(schema.$defs.capabilityAliases.const).length} aliases, ` +
|
|
766
|
+
`${Object.keys(schema.$defs.capabilityEffects.const).length} effect mappings\n`,
|
|
767
|
+
);
|
|
768
|
+
if (selfTest.failures.length === 0) {
|
|
769
|
+
process.stdout.write(`self-test: ${selfTest.cases}/${selfTest.cases} negative cases rejected\n`);
|
|
770
|
+
} else {
|
|
771
|
+
process.stdout.write(`self-test: FAIL (${selfTest.failures.length} case(s))\n`);
|
|
772
|
+
for (const failure of selfTest.failures) process.stdout.write(` ${failure}\n`);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
for (const result of results) {
|
|
776
|
+
process.stdout.write(`${result.ok ? 'PASS' : 'FAIL'} ${result.file}\n`);
|
|
777
|
+
for (const error of result.errors.slice(0, 20)) {
|
|
778
|
+
process.stdout.write(` ${error.path}: ${error.message}\n`);
|
|
779
|
+
}
|
|
780
|
+
if (result.errors.length > 20) {
|
|
781
|
+
process.stdout.write(` ... ${result.errors.length - 20} more error(s)\n`);
|
|
782
|
+
}
|
|
783
|
+
for (const warning of result.warnings) {
|
|
784
|
+
process.stdout.write(` note: ${warning}\n`);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
process.stdout.write(`${results.filter((result) => result.ok).length}/${results.length} examples valid\n`);
|
|
788
|
+
return ok ? 0 : 1;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
process.exitCode = main();
|