Principle:0sec labs 0 Versioned Report Emission
| Knowledge Sources | |
|---|---|
| Domains | Binary_Analysis, API, Reporting |
| Last Updated | 2026-10-30 00:00 GMT |
Overview
Technique for providing a single embeddable scan entrypoint with a versioned result contract that can be serialized to JSON, NDJSON, and SARIF formats.
Description
Versioned report emission is the principle that a binary scan API should have one entrypoint with a stable, versioned output contract. The single scan() function decompiles, analyzes, triages, prunes, confirms, and optionally patches a binary, returning a ScanResult (contract v1.5) that includes findings (each with id, bug_class, severity, confirmed, hypothesis, pruned, pov_path, repro_cmd, patch info), stages_run, terminal_state, and stage_outcomes. The result can be serialized to JSON, NDJSON (one finding per line), or SARIF (OASIS standard for CI/CD integration). The process environment is never mutated, so concurrent embedded scans can select different backends safely.
Usage
Use this principle when designing a binary analysis API that needs to be embedded in CI/CD pipelines, fleet analysis, or MCP integration. The versioned contract ensures consumers can depend on a stable schema while the implementation evolves.
Theoretical Basis
The contract versioning principle:
# Abstract contract (NOT real implementation)
CONTRACT_VERSION = "1.5"
@dataclass
class ScanResult:
contract_version: str = CONTRACT_VERSION
findings: list[Finding] # id, bug_class, severity, confirmed, hypothesis, pov_path
stages_run: list[str] # which pipeline stages executed
terminal_state: str # "completed" | "degraded" | "error"
stage_outcomes: list[dict] # per-stage result/notes
# Serializers are contract-bound, not implementation-bound
def result_to_json(result): ... # full ScanResult as JSON
def result_to_ndjson(result): ... # one finding per line (streaming-friendly)
def result_to_sarif(result): ... # OASIS SARIF v2.1.0 for CI/CD