report

package
v8.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 12 Imported by: 18

Documentation

Index

Constants

View Source
const (
	// https://cwe.mitre.org/data/definitions/798.html
	CWE              = "CWE-798"
	CWE_DESCRIPTION  = "Use of Hard-coded Credentials"
	StdoutReportPath = "-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactLocation

type ArtifactLocation struct {
	URI string `json:"uri"`
}

type CsvReporter added in v8.21.3

type CsvReporter struct {
}

func (*CsvReporter) Write added in v8.21.3

func (r *CsvReporter) Write(w io.WriteCloser, findings []Finding) error

type Driver

type Driver struct {
	Name            string  `json:"name"`
	SemanticVersion string  `json:"semanticVersion"`
	InformationUri  string  `json:"informationUri"`
	Rules           []Rules `json:"rules"`
}

type Failure added in v8.17.0

type Failure struct {
	XMLName xml.Name `xml:"failure"`
	Data    string   `xml:",chardata"`
	Message string   `xml:"message,attr"`
	Type    string   `xml:"type,attr"`
}

type Finding

type Finding struct {
	Description string
	StartLine   int
	EndLine     int
	StartColumn int
	EndColumn   int

	Line string `json:"-"`

	Match string

	// Secret contains the full content of what is matched in
	// the tree-sitter query.
	Secret string

	// File is the name of the file containing the finding
	File        string
	SymlinkFile string
	Commit      string

	// Entropy is the shannon entropy of Value
	Entropy float32

	Author  string
	Email   string
	Date    string
	Message string
	Tags    []string

	// Rule is the name of the rule that was matched
	RuleID string

	// unique identifier
	Fingerprint string
}

Finding contains information about strings that have been captured by a tree-sitter query.

func (*Finding) Redact

func (f *Finding) Redact(percent uint)

Redact removes sensitive information from a finding.

type FullDescription

type FullDescription struct {
	Text string `json:"text"`
}

type JsonReporter added in v8.21.3

type JsonReporter struct {
}

func (*JsonReporter) Write added in v8.21.3

func (t *JsonReporter) Write(w io.WriteCloser, findings []Finding) error

type JunitReporter added in v8.21.3

type JunitReporter struct {
}

func (*JunitReporter) Write added in v8.21.3

func (r *JunitReporter) Write(w io.WriteCloser, findings []Finding) error

type Locations

type Locations struct {
	PhysicalLocation PhysicalLocation `json:"physicalLocation"`
}

type Message

type Message struct {
	Text string `json:"text"`
}

type PartialFingerPrints

type PartialFingerPrints struct {
	CommitSha     string `json:"commitSha"`
	Email         string `json:"email"`
	Author        string `json:"author"`
	Date          string `json:"date"`
	CommitMessage string `json:"commitMessage"`
}

type PhysicalLocation

type PhysicalLocation struct {
	ArtifactLocation ArtifactLocation `json:"artifactLocation"`
	Region           Region           `json:"region"`
}

type Properties added in v8.17.0

type Properties struct {
	Tags []string `json:"tags"`
}

type Region

type Region struct {
	StartLine   int     `json:"startLine"`
	StartColumn int     `json:"startColumn"`
	EndLine     int     `json:"endLine"`
	EndColumn   int     `json:"endColumn"`
	Snippet     Snippet `json:"snippet"`
}

type Reporter added in v8.21.3

type Reporter interface {
	Write(w io.WriteCloser, findings []Finding) error
}

type Results

type Results struct {
	Message             Message     `json:"message"`
	RuleId              string      `json:"ruleId"`
	Locations           []Locations `json:"locations"`
	PartialFingerPrints `json:"partialFingerprints"`
	Properties          Properties `json:"properties"`
}

type Rules

type Rules struct {
	ID          string           `json:"id"`
	Description ShortDescription `json:"shortDescription"`
}

type Runs

type Runs struct {
	Tool    Tool      `json:"tool"`
	Results []Results `json:"results"`
}

type Sarif

type Sarif struct {
	Schema  string `json:"$schema"`
	Version string `json:"version"`
	Runs    []Runs `json:"runs"`
}

type SarifReporter added in v8.21.3

type SarifReporter struct {
	OrderedRules []config.Rule
}

func (*SarifReporter) Write added in v8.21.3

func (r *SarifReporter) Write(w io.WriteCloser, findings []Finding) error

type ShortDescription

type ShortDescription struct {
	Text string `json:"text"`
}

type Snippet

type Snippet struct {
	Text string `json:"text"`
}

type TemplateReporter added in v8.21.3

type TemplateReporter struct {
	// contains filtered or unexported fields
}

func NewTemplateReporter added in v8.21.3

func NewTemplateReporter(templatePath string) (*TemplateReporter, error)

func (*TemplateReporter) Write added in v8.21.3

func (t *TemplateReporter) Write(w io.WriteCloser, findings []Finding) error

writeTemplate renders the findings using the user-provided template. https://www.digitalocean.com/community/tutorials/how-to-use-templates-in-go

type TestCase added in v8.17.0

type TestCase struct {
	XMLName   xml.Name `xml:"testcase"`
	Classname string   `xml:"classname,attr"`
	Failure   Failure  `xml:"failure"`
	File      string   `xml:"file,attr"`
	Name      string   `xml:"name,attr"`
	Time      string   `xml:"time,attr"`
}

type TestSuite added in v8.17.0

type TestSuite struct {
	XMLName   xml.Name   `xml:"testsuite"`
	Failures  string     `xml:"failures,attr"`
	Name      string     `xml:"name,attr"`
	Tests     string     `xml:"tests,attr"`
	TestCases []TestCase `xml:"testcase"`
	Time      string     `xml:"time,attr"`
}

type TestSuites added in v8.17.0

type TestSuites struct {
	XMLName    xml.Name `xml:"testsuites"`
	TestSuites []TestSuite
}

type Tool

type Tool struct {
	Driver Driver `json:"driver"`
}

Jump to

Keyboard shortcuts

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