Documentation
¶
Overview ¶
Package sarif writes SARIF 2.1.0 logs, the format GitHub code scanning reads.
Index ¶
Constants ¶
const ( Version = "2.1.0" SchemaURI = "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json" )
Version and SchemaURI identify SARIF 2.1.0.
const ( LevelError = "error" LevelWarning = "warning" LevelNote = "note" )
Levels a result can have.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArtifactLocation ¶
type ArtifactLocation struct {
URI string `json:"uri"`
}
ArtifactLocation is a URI, relative to the repository root or absolute (s3://, dynamodb://).
type Configuration ¶
type Configuration struct {
Level string `json:"level"`
}
Configuration holds a rule's default level.
type Driver ¶
type Driver struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
InformationURI string `json:"informationUri,omitempty"`
Rules []Rule `json:"rules"`
}
Driver is the tool's main component.
type Location ¶
type Location struct {
PhysicalLocation PhysicalLocation `json:"physicalLocation"`
}
Location points at an artifact by URI.
type Log ¶
type Log struct {
Schema string `json:"$schema"`
Version string `json:"version"`
Runs []Run `json:"runs"`
}
Log is a SARIF log with one run.
type PhysicalLocation ¶
type PhysicalLocation struct {
ArtifactLocation ArtifactLocation `json:"artifactLocation"`
Region *Region `json:"region,omitempty"`
}
PhysicalLocation names an artifact and, when known, a line in it.
type Region ¶
type Region struct {
StartLine int `json:"startLine"` // 1-based
}
Region is a line of an artifact.
type Result ¶
type Result struct {
RuleID string `json:"ruleId"`
RuleIndex int `json:"ruleIndex"`
Level string `json:"level"`
Message Message `json:"message"`
Locations []Location `json:"locations"`
PartialFingerprints map[string]string `json:"partialFingerprints,omitempty"`
Suppressions []Suppression `json:"suppressions,omitempty"`
Properties map[string]any `json:"properties,omitempty"`
}
Result is one finding.
type Rule ¶
type Rule struct {
ID string `json:"id"`
ShortDescription Message `json:"shortDescription"`
FullDescription Message `json:"fullDescription,omitzero"`
Help Message `json:"help"`
DefaultConfiguration Configuration `json:"defaultConfiguration"`
Properties map[string]any `json:"properties,omitempty"`
}
Rule is one reportingDescriptor.
type Suppression ¶
type Suppression struct {
Kind string `json:"kind"` // external: from configuration, not the source
Status string `json:"status"`
Justification string `json:"justification"`
}
Suppression records why a result is accepted.