sarif

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLanguage = "en-US"
View Source
const Schema = "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json"
View Source
const Version = "2.1.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactLocation

type ArtifactLocation struct {
	URI         string   `json:"uri"`
	URIBaseID   string   `json:"uriBaseId,omitempty"`
	Index       int      `json:"index,omitempty"`
	Description *Message `json:"description,omitempty"`
}

type Level

type Level string
const (
	LevelNone    Level = "none"
	LevelNote    Level = "note"
	LevelWarning Level = "warning"
	LevelError   Level = "error"
)

type Location

type Location struct {
	ID               int               `json:"id,omitempty"`
	PhysicalLocation *PhysicalLocation `json:"physicalLocation,omitempty"`
	// This might be something that is not necessary for the current version of the tool.
	// LogicalLocation  LogicalLocation  `json:"logicalLocation,omitempty"`
	Message     *Message `json:"message,omitempty"`
	Annotations []Region `json:"annotations,omitempty"`
}

type Log

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

func FromResult

func FromResult(r *vulncheck.Result) (*Log, error)

type LogicalLocation

type LogicalLocation struct {
	Index              int                    `json:"index,omitempty"`
	Name               string                 `json:"name"`
	Kind               LogicationLocationKind `json:"kind,omitempty"`
	DecoratedName      string                 `json:"decoratedName,omitempty"`
	FullyQualifiedName string                 `json:"fullyQualifiedName,omitempty"`
	ParentIndex        int                    `json:"parentIndex,omitempty"`
}

LogicalLocation object represents a logical location such as a function, a class, or a module.

type LogicationLocationKind

type LogicationLocationKind string
const (
	LogicalLocationKingFunction   LogicationLocationKind = "function"
	LogicalLocationKingMember     LogicationLocationKind = "member"
	LogicalLocationKingModule     LogicationLocationKind = "module"
	LogicalLocationKingNamespace  LogicationLocationKind = "namespace"
	LogicalLocationKingResource   LogicationLocationKind = "resource"
	LogicalLocationKingType       LogicationLocationKind = "type"
	LogicalLocationKingReturnType LogicationLocationKind = "returnType"
	LogicalLocationKingParameter  LogicationLocationKind = "parameter"
	LogicalLocationKingVariable   LogicationLocationKind = "variable"
)

type Message

type Message struct {
	Text     string `json:"text"`
	Markdown string `json:"markdown,omitempty"`
	// ID field must be present when `text` field is empty
	ID string `json:"id,omitempty"`
}

type MultiFormatMessageString

type MultiFormatMessageString struct {
	Text     string `json:"text"`
	Markdown string `json:"markdown,omitempty"`
}

type PhysicalLocation

type PhysicalLocation struct {
	ArtifactLocation *ArtifactLocation `json:"artifactLocation,omitempty"`
	Region           *Region           `json:"region,omitempty"`
	ContextRegion    *Region           `json:"contextRegion,omitempty"`
}

type RDProperties added in v0.0.2

type RDProperties struct {
	ID          string   `json:"id,omitempty"`
	Name        string   `json:"name,omitempty"`
	Description string   `json:"description,omitempty"`
	Kind        string   `json:"kind,omitempty"`
	Precision   string   `json:"precision,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Problem     string   `json:"problem.severity,omitempty"`
}

type Region

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

type ReportingDescriptor added in v0.0.2

type ReportingDescriptor struct {
	ID               string                    `json:"id"`
	Name             string                    `json:"name,omitempty"`
	HelpURI          string                    `json:"helpUri,omitempty"`
	ShortDescription *MultiFormatMessageString `json:"shortDescription,omitempty"`
	FullDescription  *MultiFormatMessageString `json:"fullDescription,omitempty"`
	Help             *MultiFormatMessageString `json:"help,omitempty"`
	// propertyBag that makes sense for this tool.
	Properties *RDProperties `json:"properties,omitempty"`
}

type Result

type Result struct {
	Message   *Message             `json:"message"`
	RuleID    string               `json:"ruleId,omitempty"`
	RuleIndex int                  `json:"ruleIndex,omitempty"` // default -1 & minimum -1
	Rule      *ReportingDescriptor `json:"rule,omitempty"`
	Level     Level                `json:"level,omitempty"`
	Locations []Location           `json:"locations,omitempty"`
}

type Run

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

type Snippet

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

Snippet object represents a portion of the artifact that is relevant to the result. It is not necessarily an object defined in the SARIF specification.

type Tool

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

type ToolComponent

type ToolComponent struct {
	Name             string                    `json:"name"`
	GUID             string                    `json:"guid,omitempty"`
	SemanitcVersion  string                    `json:"semanticVersion,omitempty"`
	Language         string                    `json:"language,omitempty"`
	ShortDescription *MultiFormatMessageString `json:"shortDescription,omitempty"`
	FullDescription  *MultiFormatMessageString `json:"fullDescription,omitempty"`
	InformationURI   string                    `json:"informationUri,omitempty"`
	Rules            []ReportingDescriptor     `json:"rules,omitempty"`
}

Jump to

Keyboard shortcuts

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