validate-sarif
Validate SARIF Findings
Context
SARIF files produced by AI security agents must conform to three layers of correctness:
-
Base schema layer — Valid SARIF 2.1.0 per the OASIS standard. Structural issues like misplaced properties, missing required fields, or type mismatches.
Sarif.Multitool validatechecks this. -
Whole-log overlay layer —
ai-sarif-log.schema.json, the post-enrichment output schemaSarif.Multitool get-schemaserves foremit-finalize. It$refs base SARIF 2.1.0 and tightens it to the subset of Error-level AI rules JSON Schema can express at whole-log scale: theresult.ruleIdshape (CWE-<n>/<sub-id>, bareCWE-<n>, orNOVEL-<sub-id>),message.markdownnon-empty, aphysicalLocationwithregion.startLine >= 1, a per-runversionControlProvenance(so a--no-repolog is rejected — it is unpublishable),properties[ai/origin]in the closed set, and the GHAzDOautomationDetailscontract when the Azure DevOps pipeline shape is present. This overlay is advisory — the contractget-schemadocuments, not a gatevalidateruns. -
AI rich-rule layer — The conventions in
docs/ai/generating-sarif.md, enforced by the multitool's AI rule pack (AI1003–AI2019) under--rule-kind "Sarif;AI". These carry every semantic rule JSON Schema cannot express; this skill rounds out the remaining profile-level checks.
All three matter, and the boundary between layers 2 and 3 is deliberate. JSON Schema validates structure and shape; it cannot reach the semantics below. The overlay accepts these, and only the rich rules (validate) reject them:
- Closed vocabularies on the open
propertiesbag —ai/exploitability: "unconfirmed"is structurally a string, so the overlay passes it; AI2014 holds it to the{demonstrated, poc, theoretical}set. - All-or-nothing co-presence — a lone
ai/exploitabilitywith noai/attackerPosition/ai/evidencecompanion passes the overlay; AI2014 requires the triple to be all-present or all-absent. - Cross-run grouping reciprocity — the overlay validates each run independently, so a one-directional grouping link passes; AI1015 requires it to be reciprocal.
- Non-persistence — a rolling-hash
partialFingerprintsentry is a well-formed string map to the overlay; AI2011 forbids persisting it as a stable identity. - Category vs. Weakness ruleId base —
CWE-16/insecure-default-configmatches the overlay's structuralCWE-<n>/<sub-id>shape, but CWE-16 is a MITRE Category, never a valid mapping target. Whether a base CWE is a Category or a Weakness is taxonomy data the schema does not carry; the Category-mapping rule rejects it as a hard producer-emit failure. A Category ruleId is an emit bug, not something to normalize — never auto-correct it to a Weakness or a name floor.