Replies: 1 comment
|
🙄 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
ADR Precursor: Reduce Supply-Chain Exposure of the JSON Schema Validation Toolchain
Status
Proposed — precursor / undecided. No option is selected. This seed exists to gather input and converge on the trade-offs before an ADR is written.
Context
Background and Problem Statement
MIF treats JSON Schema validation as a gating CI invariant (ADR-012): every derived JSON-LD projection MUST validate against the canonical 2020-12 schemas. That gate is implemented in
.github/workflows/validate.yml. The validation step is:Separately, the ontology and memory gates already run a different validator — Python
jsonschema(Draft202012Validator) inscripts/validate-ontologies.py,scripts/validate-memories.py, andscripts/validate-namespaces.py. So the project already maintains two validator stacks: ajv (JS, for projection validation) and Pythonjsonschema(for ontology/memory/namespace validation).Current Limitations
Unpinned, mutable supply-chain entry in an otherwise SHA-pinned gate. Every
uses:invalidate.ymlis SHA-pinned (actions/checkout@9c091bb…,actions/setup-node@48b55a0…), per the org's pin-everything posture. The one exception isnpm install -g ajv-cli ajv-formats(L77): a global, version-floating install that resolvesajv-cli,ajv-formats, and their transitive npm dependencies fresh at CI time, with no lockfile and no integrity pin. This is the softest link in a gate that ADR-015 otherwise hardens to SLSA L3.Two validator stacks, two trust roots. The projection gate trusts the npm registry + ajv's transitive tree; the ontology/memory gates trust PyPI +
jsonschema's tree. Divergent behavior between the two stacks (e.g. format-assertion handling) is possible and unmonitored.No attestation over the validator itself. MIF attests its release artifacts (ADR-015) but the tool that asserts schema conformance is pulled unattested at run time.
Decision Drivers
Primary Decision Drivers
ajv-formatsbehavior, and must keep external$refresolution againstschema/definitions/*.schema.json.Secondary Decision Drivers
Considered Options
Option 1: Adopt the Rust
jsonschemacrate (jsonschema-cli), pinned + attestedDescription: Replace ajv with the Rust
jsonschemavalidator (v0.42 at time of writing, Rust ≥ 1.83) via itsjsonschema-cli, built and attested like other release artifacts, or vendored as a pinned binary.Advantages:
$refresolution.boon).Disadvantages:
ajv-formatsmust be verified against the 2020-12 conformance suite.Risk Assessment: Technical: Medium (format/keyword parity must be proven). Schedule: Medium. Ecosystem: Low–Medium (actively maintained, recent release).
Option 2: Adopt
boon(pure-Rust validator/CLI)Description: Use
boon(library + CLI), draft 2020-12 / 2019-09 / 7 / 6 / 4.Advantages:
Disadvantages:
jsonschemacrate (reported 2–52× in the maintainers' comparison); performance is a secondary driver so this is minor.Risk Assessment: Technical: Medium. Schedule: Medium. Ecosystem: Medium.
Option 3 (exculpatory — keep current): Keep
ajv-cli+ajv-formats, harden the installDescription: Retain the canonical JS reference validator but remove the floating-global weakness: pin via a committed lockfile /
npm cifrom a small dedicated manifest, prefer exact versions, enable npm provenance, and let Dependabot bump deliberately.Advantages:
ajv-formats; zero behavioral risk — the gate keeps doing exactly what it does today.Disadvantages:
Risk Assessment: Technical: Low. Schedule: Low. Ecosystem: Low.
Option 4 (exculpatory alternative — consolidate): Drop ajv, use the already-vendored Python
jsonschemaDescription: Validate projections with the Python
jsonschema(Draft202012Validator) the repo already depends on for ontology/memory/namespace gates. Add a thin projection-validation script; remove the npm validator entirely.Advantages:
actions/setup-python,pip install).pip install jsonschema==X/ lockfile.Disadvantages:
jsonschema's 2020-12 + format-assertion coverage differs fromajv-formats; parity must be checked (formats are opt-in and requireformatcheckers /fqformatextras).$refresolution againstschema/definitions/*.Risk Assessment: Technical: Medium (format parity). Schedule: Low. Ecosystem: Low.
Decision
PENDING. Deliberately undecided. This precursor records the option space; the eventual ADR will select one after the open questions are answered.
Open Questions
ajv-formatsformats does the gate actually rely on, and does each candidate (Rustjsonschema,boon, Pythonjsonschema) assert them identically under 2020-12?$refresolution: does each candidate resolve-r "schema/definitions/*.schema.json"equivalently?Links
validate.yml— the gatejsonschemacrate ·jsonschema-cliboon(santhosh-tekuri)ajvJSON Schema validator ·ajv-formatsAll reactions