Skip to content

M56 (TASK-113-FREE): Free SARIF v2.1.0 Export in verity-redteam-core

1. Purpose & Architectural Decisions

  • Problem: --format sarif is Pro-gated in verity-redteam-core, which blocks the #1 AppSec evaluation funnel — the 5-line GitHub Actions PR check plus GitHub Code Scanning SARIF upload.
  • Decision (P0.1): Unblock OASIS SARIF v2.1.0 in the Apache-2.0 Free core with zero Pro gate for single-repo export: verity scan . --format sarif -o results.sarif and verity test --format sarif. This supersedes the M40 (TASK-103-FREE) SARIF Pro gate (PRO_FEATURE_REQUIRED, exit code 2).
  • Deterministic truth invariant: identical findings must serialize to a byte-identical SARIF document. file_path maps to artifactLocation.uri; line_number maps to region.startLine (fallback 1 when missing, "-", 0, or negative); runs[0].tool.driver.version == verity.__version__ (per M18). Suppression/policy semantics are unchanged by the un-gating.
  • Free/Pro boundary: Free owns single-run SARIF export from the CLI, the viewer, and action.yml. Commercial Pro (verity-lite) retains fleet/multi-repo governance, PR baseline drift tracking (partialFingerprints / suppressions[], TASK-80-PRO), signed compliance audit bundles, and closed-loop worktree autofix.

2. Target Files & Technical Deliverables

File Deliverable
src/verity/cli.py Remove the _pro_plugin_available() gate on --format sarif; delegate to the core SARIF builder (ConsolidatedSecurityAuditor.render_sarif via _stdlib_sarif_exporter). Exit 0 (clean) / 1 (findings); never PRO_FEATURE_REQUIRED.
src/verity/discovery/auditor.py render_sarif preserves artifactLocation.uri, region.startLine (fallback 1), and driver.version sourced from verity.__version__.
src/verity/viewer/actions.py Remove the Pro gate in export_run_artifact(..., "sarif"); single-run SARIF export is Free.
src/verity/viewer/static/views/findings.js Drop the [Pro] suffix from the SARIF v2.1.0 export flyout entry.
action.yml upload-sarif succeeds in Free without verity-pro; sarif-generated=true whenever findings serialize.
README.md, docs/pro/enterprise_features.md Document Free SARIF export; narrow Pro framing to fleet/drift/signed bundles/autofix.
tests/unit/cli/test_sarif_pro_gate.py Assert Free SARIF succeeds (exit 0/1) with a valid OASIS v2.1.0 document and non-empty artifact.
tests/unit/cli/test_sarif_line_precision.py Retain uri / startLine precision assertions.
tests/unit/test_readme_parity.py Update test_readme_sarif_pro_badge to Free-badge expectations.

Edge cases: empty findings -> valid SARIF with runs[0].results == [] (exit 0); null/"-"/0 line -> startLine: 1; --output writes stay atomic (no partial artifact on failure); --format sarif accepts --fail-on-findings and --fail-on-severity thresholds unchanged.

3. ATDD Traceability Matrix

AC ID Acceptance Criterion Paired Benign / Negative Control Verification Tier Test Target
AC-56.1 verity scan <target> --format sarif -o results.sarif without verity-pro emits valid OASIS SARIF v2.1.0 (version: "2.1.0", $schema, driver.version == verity.__version__) and exits 0 (clean) or 1 (findings), never PRO_FEATURE_REQUIRED. Clean target yields valid SARIF with runs[0].results == [] and exit 0. unit tests/unit/cli/test_sarif_pro_gate.py::test_free_sarif_export_without_pro_plugin
AC-56.2 Exported SARIF preserves the real artifactLocation.uri and region.startLine. Missing/"-"/0 line falls back to startLine: 1. unit tests/unit/cli/test_sarif_line_precision.py::test_sarif_preserves_line
AC-56.3 verity view SARIF export and action.yml upload-sarif succeed in Free; docs/parity stay consistent. Free formats (terminal, json, markdown, html) never carry a [Pro] badge while the Pro matrix stays intact. unit tests/unit/test_readme_parity.py::test_readme_sarif_pro_badge
AC-56.4 Lint and the full unit suite pass. Clean workspace yields zero lint or parity errors. ruff uv run ruff check src tests scripts && uv run pytest tests/

4. Verification Commands

uv run pytest tests/unit/cli/test_sarif_pro_gate.py tests/unit/cli/test_sarif_line_precision.py tests/unit/test_readme_parity.py
uv run pytest tests/
uv run ruff check src tests scripts

5. Execution Checklist

  • [ ] AC-56.1 verified green
  • [ ] AC-56.2 verified green
  • [ ] AC-56.3 verified green
  • [ ] AC-56.4 verified green
  • [ ] Board #5 item PVTI_lAHOD-xmQM4Br351zhOMCxo synced & status updated