sarif

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sarif renders engine reports as SARIF 2.1.0 for GitHub code scanning. Shared by the CLI's --output sarif and the server's /api/v1/gate?format=sarif endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unanchored added in v0.2.0

func Unanchored(r engine.Report) int

Unanchored counts the findings Write leaves out because none of their objects has a file location (live-cluster findings, add-ons, skew, kb-stale, a manifest stream posted to /gate without ?path=). Callers can tell users the SARIF is not the whole report.

func Write

func Write(w io.Writer, r engine.Report, toolVersion string) error

Write renders the report as SARIF 2.1.0 that GitHub code scanning accepts: GitHub rejects the whole file if any result lacks a physical location, so every result carries one (artifactLocation.uri = the object's file, region.startLine = its apiVersion line) and findings without any file location are not results (see Unanchored). One result per (finding, located object), in report order; one rule per finding Key (falling back to the category), listed only when it has results, with the finding's remediation as help and its first citation as helpUri. toolVersion stamps tool.driver.version ("" omits it).

Nothing is dropped silently: every unanchored finding is a tool execution notification at its severity's level (a /gate stream without ?path= has no file names, so all of its findings land there), objects not listed as results are counted in a note, required and partial assessment gaps are notifications too, and run.properties records ready, the verdict, score, the counts and every gap, so the document never reads as a clean pass that the report is not.

Suppressed findings (Report.Suppressed) are never results: GitHub code scanning ignores a result's "suppressions" property and opens an alert for every located result at its level, so a result for an accepted finding would show as an open alert in the Security tab although the gate passed (#375). One run-level note counts the located ones left out; the unanchored ones stay notes with their reason. The JSON report, the step summary and JUnit list them all. A report compared with a baseline sets each result's baselineState.

Types

This section is empty.

Directories

Path Synopsis
Package sariftest checks SARIF documents against what GitHub code scanning accepts, for every package that emits SARIF (the CLI's --output sarif and the server's /api/v1/gate?format=sarif).
Package sariftest checks SARIF documents against what GitHub code scanning accepts, for every package that emits SARIF (the CLI's --output sarif and the server's /api/v1/gate?format=sarif).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL