feat(cli): emit governance findings as SARIF 2.1.0 - #499
Merged
Merged
Conversation
openlore enforce --sarif <path> and openlore review --sarif <path> also write the findings they classified as a deterministic SARIF 2.1.0 log: every registered code as a rule, each finding as a result with its message verbatim, a fixed severity-to-level table, the enforcement class as a property, and an identity hash. A recorded repository-relative location becomes a physical location; anything else is a logical location, never a fabricated line. Printed output and exit codes are unchanged, and a write failure only warns. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
Not LGTM yet. Four parallel adversarial reviews and CI are in progress.
What was missing
Governance findings reached consumers only through the
openlore reviewMarkdown briefing and theopenlore enforceexit code. Code-scanning surfaces (per-line PR annotations, dismissal workflows, rules on scanning results) read SARIF, and OpenLore wrote none, so a team had to parse OpenLore's JSON in custom CI glue.What it does
--sarif <path>onopenlore enforceandopenlore reviewalso writes a SARIF 2.1.0 log. Not combinable withenforce --agent-hook.FINDING_CODE_REGISTRY, sorted, with its description, source, and default enforcement class.critical/error→error,warning→warning,info→note); enforcement class, severity, source, subject, and baseline state as properties; a SHA-256 of the finding identity inpartialFingerprints.locationbecomes a physical location, with a line only when recorded. No location, an absolute path, or a path that escapes the root becomes a logical location named by the subject.Proof
src/core/services/sarif.test.ts: every registry code as a sorted rule; a located finding's physical location, verbatim message, level, and class property; logical-only locations for no, absolute, escaping, and Windows-absolute paths; the full level table and unregistered codes; byte-identical output for reordered input with no timestamps.src/cli/commands/enforce.test.ts:runEnforceCli({ json: true })with and without--sarifgives the same exit code and the same stdout, and writes a SARIF 2.1.0 log;--agent-hookwith--sarifis refused.2026-09-13-add-sarif-finding-emission(ADDFindingsAreEmittableAsSarifTransport).openspec validate --specs --strictpasses.Notes
location(no graph span lookup), rules have nohelpUri, and the log shape is checked structurally rather than against a vendored JSON schema.🤖 Generated with Claude Code