report

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package report renders scan results as text, JSON or SARIF.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(w io.Writer, r *Report) error

JSON writes the full report. Empty lists are written as [] rather than null.

func SARIF

func SARIF(w io.Writer, r *Report) error

SARIF writes vulnerable and unknown findings as SARIF 2.1.0, which DefectDojo and most code scanning tools import. Rule IDs are "<detector>/<kind>". Every result has a fingerprint that stays the same across runs (DefectDojo deduplicates on it) and does not depend on line numbers or wording.

func Text

func Text(w io.Writer, r *Report, o Options)

Text writes a human-readable report.

Types

type DetectorInfo

type DetectorInfo struct {
	ID         string     `json:"id"`
	Title      string     `json:"title"`
	CVEs       []string   `json:"cves,omitempty"`
	Advisories []string   `json:"advisories,omitempty"`
	Data       string     `json:"data,omitempty"`
	Kinds      []KindInfo `json:"kinds,omitempty"`
}

DetectorInfo is what the report says about each detector that ran.

type KindInfo added in v0.4.0

type KindInfo struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	// Level is the SARIF level: error, warning or note.
	Level string `json:"level"`
	// Severity is the CVSS-style score ("9.2"), when the kind has one.
	Severity string `json:"severity,omitempty"`
}

KindInfo is one type of finding a detector reports, so a reader can rank a finding by its kind without a table of its own.

type Options

type Options struct {
	ShowCleared bool // list fixed and inactive findings
	ShowSkipped bool // list every file that could not be scanned
}

Options control the text report.

type Report

type Report struct {
	Tool      string           `json:"tool"`
	Version   string           `json:"version"`
	Detectors []DetectorInfo   `json:"detectors"`
	Targets   []*engine.Target `json:"targets"`
	// contains filtered or unexported fields
}

Report is the whole run.

func New

func New(tool, version string, dets []engine.Detector) *Report

New starts a report for the detectors that will run.

Jump to

Keyboard shortcuts

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