Skip to content

Add review_sarif to export review findings as SARIF 2.1.0 #103

Backlog

Description

@P1Manav

Summary

Add a review_sarif(outcome, organization_id) helper in proofline to export a ReviewOutcome into a standard SARIF 2.1.0 document, matching the CLI's --sarif format.

Motivation

Teams running Proofline in Python-based CI/CD workflows and automated test runners need review findings formatted as SARIF 2.1.0 to upload to GitHub Advanced Security / Code Scanning (code-scanning/sarif), GitLab SAST, or IDE consumers.

Currently, callers must either install and spawn the CLI binary or implement the complex SARIF projection mapping manually (handling verified reviewed head commit validation, code citation locations, partial fingerprints, and execution notifications).

Exposing review_sarif directly in the Python SDK enables callers to write:

import json
from pathlib import Path
from proofline import ProoflineClient, review_sarif

with ProoflineClient() as client:
    outcome = client.wait_for_review(organization_id, review_id)
    Path("proofline.sarif").write_text(json.dumps(review_sarif(outcome, organization_id)))

Activity

  1. arshian11 commented on Nov 25, 2026

    @arshian11

    Hi @P1Manav
    Could you please take a look and let me know if this approach aligns with the intended solution? Thanks

    Approach

    proofline/sarif.py — Added review_sarif(outcome, organization_id) to export retained pull-request reviews as SARIF 2.1.0. The exporter follows the CLI’s format for verified citation locations, retained fingerprints, and execution notifications. It requires a full reviewed head SHA and rejects outcomes with a recorded head mismatch.

    proofline/outcomes.py — Shared CODE assessment validation and gap detection with the exporter so SARIF can report CODE gaps alongside completed environment assessments.

    proofline/init.py and README.md — Exposed review_sarif as a public import and documented how to write the report to a file.

    Verification

    Added regression tests in tests/test_sarif.py covering verified citation locations, fingerprint handling, incomplete and timed-out reviews, and head validation. Sample reports passed validation against the OASIS SARIF 2.1.0 schema.

    Ran python3 scripts/check.py in a temporary LF checkout. All 222 tests passed, along with linting, formatting, type checks, contract checks, and wheel and source install checks.

  2. P1Manav commented on Nov 26, 2026

    @P1Manav
    Author

    Hi @arshian11, sorry for the confusion, I had opened #104 for this on Nov 24 but forgot to link it to the issue. I've linked it now. Your approach looks good too. Happy for the maintainers to review both and go with whichever fits best.

  3. arshian11 commented on Nov 26, 2026

    @arshian11

    @P1Manav No worries, thanks for clarifying!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions