sarif

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: Unlicense Imports: 7 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address added in v1.0.0

type Address struct {
	PropertyBag
	Index              *uint   `json:"index,omitempty"`
	AbsoluteAddress    *uint   `json:"absoluteAddress,omitempty"`
	RelativeAddress    *int    `json:"relativeAddress,omitempty"`
	OffsetFromParent   *int    `json:"offsetFromParent,omitempty"`
	Length             *int    `json:"length,omitempty"`
	Name               *string `json:"name,omitempty"`
	FullyQualifiedName *string `json:"fullyQualifiedName,omitempty"`
	Kind               *string `json:"kind,omitempty"`
	ParentIndex        *uint   `json:"parentIndex,omitempty"`
}

func NewAddress added in v1.0.0

func NewAddress() *Address

func (*Address) WithAbsoluteAddress added in v1.0.0

func (a *Address) WithAbsoluteAddress(absoluteAddress int) *Address

func (*Address) WithFullyQualifiedName added in v1.0.0

func (a *Address) WithFullyQualifiedName(fullyQualifiedName string) *Address

func (*Address) WithIndex added in v1.0.0

func (a *Address) WithIndex(index int) *Address

func (*Address) WithKind added in v1.0.0

func (a *Address) WithKind(kind string) *Address

func (*Address) WithLength added in v1.0.0

func (a *Address) WithLength(length int) *Address

func (*Address) WithName added in v1.0.0

func (a *Address) WithName(name string) *Address

func (*Address) WithOffsetFromParent added in v1.0.0

func (a *Address) WithOffsetFromParent(offsetFromParent int) *Address

func (*Address) WithParentIndex added in v1.0.0

func (a *Address) WithParentIndex(parentIndex int) *Address

func (*Address) WithRelativeAddress added in v1.0.0

func (a *Address) WithRelativeAddress(relativeAddress int) *Address

type Artifact added in v1.0.0

type Artifact struct {
	PropertyBag
	Location            *ArtifactLocation `json:"location,omitempty"`
	ParentIndex         *uint             `json:"parentIndex,omitempty"`
	Offset              *uint             `json:"offset,omitempty"`
	Length              int               `json:"length"`
	Roles               []string          `json:"roles,omitempty"`
	MimeType            *string           `json:"mimeType,omitempty"`
	Contents            *ArtifactContent  `json:"contents,omitempty"`
	Encoding            *string           `json:"encoding,omitempty"`
	SourceLanguage      *string           `json:"sourceLanguage,omitempty"`
	Hashes              map[string]string `json:"hashes,omitempty"`
	LastModifiedTimeUtc *string           `json:"lastModifiedTimeUtc,omitempty"`
	Description         *Message          `json:"description,omitempty"`
}

func NewArtifact added in v1.0.0

func NewArtifact() *Artifact

func (*Artifact) WithContents added in v1.0.0

func (a *Artifact) WithContents(artifactContent *ArtifactContent) *Artifact

func (*Artifact) WithDescription added in v1.0.0

func (a *Artifact) WithDescription(message *Message) *Artifact

func (*Artifact) WithEncoding added in v1.0.0

func (a *Artifact) WithEncoding(encoding string) *Artifact

func (*Artifact) WithHashes added in v1.0.0

func (a *Artifact) WithHashes(hashes map[string]string) *Artifact

func (*Artifact) WithLastModifiedTimeUtc added in v1.0.0

func (a *Artifact) WithLastModifiedTimeUtc(lastModified string) *Artifact

func (*Artifact) WithLength added in v1.0.0

func (a *Artifact) WithLength(length int) *Artifact

func (*Artifact) WithLocation added in v1.0.0

func (a *Artifact) WithLocation(artifactLocation *ArtifactLocation) *Artifact

func (*Artifact) WithMimeType added in v1.0.0

func (a *Artifact) WithMimeType(mimeType string) *Artifact

func (*Artifact) WithOffset added in v1.0.0

func (a *Artifact) WithOffset(offset int) *Artifact

func (*Artifact) WithParentIndex added in v1.0.0

func (a *Artifact) WithParentIndex(parentIndex int) *Artifact

func (*Artifact) WithRole added in v1.0.0

func (a *Artifact) WithRole(role string) *Artifact

func (*Artifact) WithSourceLanguage added in v1.0.0

func (a *Artifact) WithSourceLanguage(sourceLanguage string) *Artifact

type ArtifactChange added in v1.0.0

type ArtifactChange struct {
	PropertyBag
	ArtifactLocation ArtifactLocation `json:"artifactLocation"`
	Replacements     []*Replacement   `json:"replacements"` //required
}

func NewArtifactChange added in v1.0.0

func NewArtifactChange(artifactLocation *ArtifactLocation) *ArtifactChange

func (*ArtifactChange) WithReplacement added in v1.0.0

func (a *ArtifactChange) WithReplacement(replacement *Replacement) *ArtifactChange

type ArtifactContent added in v1.0.0

type ArtifactContent struct {
	PropertyBag
	Text     *string                   `json:"text,omitempty"`
	Binary   *string                   `json:"binary,omitempty"`
	Rendered *MultiformatMessageString `json:"rendered,omitempty"`
}

func NewArtifactContent added in v1.0.0

func NewArtifactContent() *ArtifactContent

func (*ArtifactContent) WithBinary added in v1.0.0

func (a *ArtifactContent) WithBinary(binary string) *ArtifactContent

func (*ArtifactContent) WithRendered added in v1.0.0

func (*ArtifactContent) WithText added in v1.0.0

func (a *ArtifactContent) WithText(text string) *ArtifactContent

type ArtifactLocation added in v1.0.0

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

func NewArtifactLocation added in v1.0.0

func NewArtifactLocation() *ArtifactLocation

func NewSimpleArtifactLocation added in v1.0.0

func NewSimpleArtifactLocation(uri string) *ArtifactLocation

func (*ArtifactLocation) WithDescription added in v1.0.0

func (a *ArtifactLocation) WithDescription(message *Message) *ArtifactLocation

func (*ArtifactLocation) WithIndex added in v1.0.0

func (a *ArtifactLocation) WithIndex(index int) *ArtifactLocation

func (*ArtifactLocation) WithUri added in v1.0.0

func (a *ArtifactLocation) WithUri(uri string) *ArtifactLocation

func (*ArtifactLocation) WithUriBaseId added in v1.0.0

func (a *ArtifactLocation) WithUriBaseId(uriBaseId string) *ArtifactLocation

type Fix added in v1.0.0

type Fix struct {
	PropertyBag
	Description     *Message          `json:"description,omitempty"`
	ArtifactChanges []*ArtifactChange `json:"artifactChanges"` //	required
}

func NewFix added in v1.0.0

func NewFix() *Fix

func (*Fix) WithArtifactChange added in v1.0.0

func (f *Fix) WithArtifactChange(ac *ArtifactChange) *Fix

func (*Fix) WithDescription added in v1.0.0

func (f *Fix) WithDescription(message *Message) *Fix

type Invocation added in v1.0.1

type Invocation struct {
	PropertyBag
	StartTimeUTC        *time.Time        `json:"startTimeUtc,omitempty"`
	EndTimeUTC          *time.Time        `json:"endTimeUtc,omitempty"`
	ExecutionSuccessful bool              `json:"executionSuccessful"`
	WorkingDirectory    *ArtifactLocation `json:"workingDirectory,omitempty"`
}

Invocation describes the runtime environment of the analysis tool run.

func (*Invocation) WithEndTimeUTC added in v1.0.1

func (i *Invocation) WithEndTimeUTC(endTime time.Time) *Invocation

WithEndTimeUTC sets the instant when the invocation ended and returns the same Invocation.

func (*Invocation) WithStartTimeUTC added in v1.0.1

func (i *Invocation) WithStartTimeUTC(startTime time.Time) *Invocation

WithStartTimeUTC sets the instant when the invocation started and returns the same Invocation.

func (*Invocation) WithWorkingDirectory added in v1.0.1

func (i *Invocation) WithWorkingDirectory(workingDirectory *ArtifactLocation) *Invocation

WithWorkingDirectory sets the current working directory of the invocation and returns the same Invocation.

type Location added in v1.0.0

type Location struct {
	PropertyBag
	Id               *uint                   `json:"id,omitempty"`
	PhysicalLocation *PhysicalLocation       `json:"physicalLocation,omitempty"`
	LogicalLocations []*LogicalLocation      `json:"logicalLocations,omitempty"`
	Message          *Message                `json:"message,omitempty"`
	Annotations      []*Region               `json:"annotations,omitempty"`
	Relationships    []*LocationRelationship `json:"relationships,omitempty"`
}

func NewLocation added in v1.0.0

func NewLocation() *Location

func NewLocationWithPhysicalLocation added in v1.0.2

func NewLocationWithPhysicalLocation(physicalLocation *PhysicalLocation) *Location

func (*Location) WithAnnotation added in v1.0.0

func (l *Location) WithAnnotation(region *Region) *Location

func (*Location) WithId added in v1.0.0

func (l *Location) WithId(id int) *Location

func (*Location) WithMessage added in v1.0.0

func (l *Location) WithMessage(message *Message) *Location

func (*Location) WithPhysicalLocation added in v1.0.0

func (l *Location) WithPhysicalLocation(physicalLocation *PhysicalLocation) *Location

func (*Location) WithRelationship added in v1.0.0

func (l *Location) WithRelationship(locationRelationship *LocationRelationship) *Location

type LocationRelationship added in v1.0.0

type LocationRelationship struct {
	PropertyBag
	Target      uint     `json:"target"`
	Kinds       []string `json:"kinds,omitempty"`
	Description *Message `json:"description,omitempty"`
}

func NewLocationRelationship added in v1.0.0

func NewLocationRelationship(target int) *LocationRelationship

func (*LocationRelationship) WithDescription added in v1.0.0

func (l *LocationRelationship) WithDescription(message *Message) *LocationRelationship

func (*LocationRelationship) WithKind added in v1.0.0

type LogicalLocation added in v1.0.0

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

func NewLogicalLocation added in v1.0.0

func NewLogicalLocation() *LogicalLocation

func (*LogicalLocation) WithDecoratedName added in v1.0.0

func (l *LogicalLocation) WithDecoratedName(decoratedName string) *LogicalLocation

func (*LogicalLocation) WithFullyQualifiedName added in v1.0.0

func (l *LogicalLocation) WithFullyQualifiedName(fullyQualifiedName string) *LogicalLocation

func (*LogicalLocation) WithIndex added in v1.0.0

func (l *LogicalLocation) WithIndex(index int) *LogicalLocation

func (*LogicalLocation) WithKind added in v1.0.0

func (l *LogicalLocation) WithKind(kind string) *LogicalLocation

func (*LogicalLocation) WithName added in v1.0.0

func (l *LogicalLocation) WithName(name string) *LogicalLocation

func (*LogicalLocation) WithParentIndex added in v1.0.0

func (l *LogicalLocation) WithParentIndex(parentIndex int) *LogicalLocation

type Message added in v1.0.0

type Message struct {
	PropertyBag
	Text      *string  `json:"text,omitempty"`
	Markdown  *string  `json:"markdown,omitempty"`
	Id        *string  `json:"id,omitempty"`
	Arguments []string `json:"arguments,omitempty"`
}

func NewMarkdownMessage added in v1.0.0

func NewMarkdownMessage(markdown string) *Message

func NewMessage added in v1.0.0

func NewMessage() *Message

func NewTextMessage added in v1.0.0

func NewTextMessage(text string) *Message

func (*Message) WithArgument added in v1.0.0

func (m *Message) WithArgument(argument string) *Message

func (*Message) WithId added in v1.0.0

func (m *Message) WithId(id string) *Message

func (*Message) WithMarkdown added in v1.0.0

func (m *Message) WithMarkdown(markdown string) *Message

func (*Message) WithText added in v1.0.0

func (m *Message) WithText(text string) *Message

type MultiformatMessageString added in v1.0.0

type MultiformatMessageString struct {
	PropertyBag
	Text     *string `json:"text,omitempty"`
	Markdown *string `json:"markdown,omitempty"`
}

func NewMarkdownMultiformatMessageString added in v1.1.0

func NewMarkdownMultiformatMessageString(markdown string) *MultiformatMessageString

func NewMultiformatMessageString added in v1.0.0

func NewMultiformatMessageString(text string) *MultiformatMessageString

func (*MultiformatMessageString) WithMarkdown added in v1.0.0

func (m *MultiformatMessageString) WithMarkdown(markdown string) *MultiformatMessageString

type PhysicalLocation added in v1.0.0

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

func NewPhysicalLocation added in v1.0.0

func NewPhysicalLocation() *PhysicalLocation

func (*PhysicalLocation) WithAddress added in v1.0.0

func (pl *PhysicalLocation) WithAddress(address *Address) *PhysicalLocation

func (*PhysicalLocation) WithArtifactLocation added in v1.0.0

func (pl *PhysicalLocation) WithArtifactLocation(artifactLocation *ArtifactLocation) *PhysicalLocation

func (*PhysicalLocation) WithContextRegion added in v1.0.0

func (pl *PhysicalLocation) WithContextRegion(contextRegion *Region) *PhysicalLocation

func (*PhysicalLocation) WithRegion added in v1.0.0

func (pl *PhysicalLocation) WithRegion(region *Region) *PhysicalLocation

type Properties added in v1.0.2

type Properties map[string]interface{}

type PropertyBag added in v1.0.2

type PropertyBag struct {
	Properties Properties `json:"properties,omitempty"`
}

func NewPropertyBag added in v1.0.2

func NewPropertyBag() *PropertyBag

func (*PropertyBag) Add added in v1.0.2

func (pb *PropertyBag) Add(key string, value interface{})

func (*PropertyBag) AddBoolean added in v1.0.2

func (pb *PropertyBag) AddBoolean(key string, value bool)

func (*PropertyBag) AddInteger added in v1.0.2

func (pb *PropertyBag) AddInteger(key string, value int)

func (*PropertyBag) AddString added in v1.0.2

func (pb *PropertyBag) AddString(key, value string)

type Region added in v1.0.0

type Region struct {
	PropertyBag
	StartLine      *int             `json:"startLine,omitempty"`
	StartColumn    *int             `json:"startColumn,omitempty"`
	EndLine        *int             `json:"endLine,omitempty"`
	EndColumn      *int             `json:"endColumn,omitempty"`
	CharOffset     *int             `json:"charOffset,omitempty"`
	CharLength     *int             `json:"charLength,omitempty"`
	ByteOffset     *int             `json:"byteOffset,omitempty"`
	ByteLength     *int             `json:"byteLength,omitempty"`
	Snippet        *ArtifactContent `json:"snippet,omitempty"`
	Message        *Message         `json:"message,omitempty"`
	SourceLanguage *string          `json:"sourceLanguage,omitempty"`
}

func NewRegion added in v1.0.0

func NewRegion() *Region

func NewSimpleRegion added in v1.0.0

func NewSimpleRegion(startLine, endLine int) *Region

func (*Region) WithByteLength added in v1.0.0

func (r *Region) WithByteLength(byteLength int) *Region

func (*Region) WithByteOffset added in v1.0.0

func (r *Region) WithByteOffset(byteOffset int) *Region

func (*Region) WithCharLength added in v1.0.0

func (r *Region) WithCharLength(charLength int) *Region

func (*Region) WithCharOffset added in v1.0.0

func (r *Region) WithCharOffset(charOffset int) *Region

func (*Region) WithEndColumn added in v1.0.0

func (r *Region) WithEndColumn(endColumn int) *Region

func (*Region) WithEndLine added in v1.0.0

func (r *Region) WithEndLine(endLine int) *Region

func (*Region) WithMessage added in v1.0.0

func (r *Region) WithMessage(message *Message) *Region

func (*Region) WithSnippet added in v1.0.0

func (r *Region) WithSnippet(snippet *ArtifactContent) *Region

func (*Region) WithSourceLanguage added in v1.0.0

func (r *Region) WithSourceLanguage(sourceLanguage string) *Region

func (*Region) WithStartColumn added in v1.0.0

func (r *Region) WithStartColumn(startColumn int) *Region

func (*Region) WithStartLine added in v1.0.0

func (r *Region) WithStartLine(startLine int) *Region

type Replacement added in v1.0.0

type Replacement struct {
	PropertyBag
	DeletedRegion   Region           `json:"deletedRegion"`
	InsertedContent *ArtifactContent `json:"insertedContent,omitempty"`
}

func NewReplacement added in v1.0.0

func NewReplacement(region *Region) *Replacement

func (*Replacement) WithInsertedContent added in v1.0.0

func (r *Replacement) WithInsertedContent(artifactContent *ArtifactContent) *Replacement

type Report

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

Report is the encapsulating type representing a Sarif Report

func FromBytes added in v0.0.8

func FromBytes(content []byte) (*Report, error)

FromBytes loads a Report from a byte array

func FromString added in v0.0.6

func FromString(content string) (*Report, error)

FromString loads a Report from string content

func New

func New(version Version) (*Report, error)

New Creates a new Report or returns an error

func Open added in v0.0.6

func Open(filename string) (*Report, error)

Open loads a Report from a file

func (*Report) AddRun

func (sarif *Report) AddRun(run *Run)

AddRun allows adding run information to the current report

func (*Report) PrettyWrite

func (sarif *Report) PrettyWrite(w io.Writer) error

PrettyWrite writes the JSON output with indentation

func (*Report) Write

func (sarif *Report) Write(w io.Writer) error

Write writes the JSON as a string with no formatting

func (*Report) WriteFile added in v1.0.7

func (sarif *Report) WriteFile(filename string) error

WriteFile will write the report to a file using a pretty formatter

type ReportingConfiguration added in v1.1.0

type ReportingConfiguration struct {
	Enabled    bool         `json:"enabled,omitempty"`
	Level      interface{}  `json:"level,omitempty"`
	Parameters *PropertyBag `json:"parameters,omitempty"`
	Properties *PropertyBag `json:"properties,omitempty"`
	Rank       float64      `json:"rank,omitempty"`
}

type ReportingDescriptor added in v1.1.0

type ReportingDescriptor struct {
	PropertyBag
	ID                   string                    `json:"id"`
	Name                 *string                   `json:"name,omitempty"`
	ShortDescription     *MultiformatMessageString `json:"shortDescription"`
	FullDescription      *MultiformatMessageString `json:"fullDescription,omitempty"`
	DefaultConfiguration *ReportingConfiguration   `json:"defaultConfiguration,omitempty"`
	HelpURI              *string                   `json:"helpUri,omitempty"`
	Help                 *MultiformatMessageString `json:"help,omitempty"`
	Properties           Properties                `json:"properties,omitempty"`
}

ReportingDescriptor specifies a Sarif ReportingDescriptor object

func (*ReportingDescriptor) AttachPropertyBag added in v1.1.0

func (rule *ReportingDescriptor) AttachPropertyBag(pb *PropertyBag)

AttachPropertyBag adds a property bag to a rule

func (*ReportingDescriptor) WithDescription added in v1.1.0

func (rule *ReportingDescriptor) WithDescription(description string) *ReportingDescriptor

WithDescription specifies short description for a rule and returns the updated rule. Short description should be a single sentence that is understandable when visible space is limited to a single line of text.

func (*ReportingDescriptor) WithFullDescription added in v1.1.0

func (rule *ReportingDescriptor) WithFullDescription(description *MultiformatMessageString) *ReportingDescriptor

WithFullDescription specifies full description for a rule and returns the updated rule. Full description should, as far as possible, provide details sufficient to enable resolution of any problem indicated by the result.

func (*ReportingDescriptor) WithHelp added in v1.1.0

func (rule *ReportingDescriptor) WithHelp(helpText string) *ReportingDescriptor

WithHelp specifies a help text for a rule and returns the updated rule

func (*ReportingDescriptor) WithHelpURI added in v1.1.0

func (rule *ReportingDescriptor) WithHelpURI(helpURI string) *ReportingDescriptor

WithHelpURI specifies a helpURI for a rule and returns the updated rule

func (*ReportingDescriptor) WithMarkdownHelp added in v1.1.0

func (rule *ReportingDescriptor) WithMarkdownHelp(markdownText string) *ReportingDescriptor

WithMarkdownHelp specifies a help text for a rule and returns the updated rule

func (*ReportingDescriptor) WithName added in v1.1.0

func (rule *ReportingDescriptor) WithName(name string) *ReportingDescriptor

WithName specifies rule name that is understandable to an end user and returns the updated rule.

func (*ReportingDescriptor) WithProperties added in v1.1.0

func (rule *ReportingDescriptor) WithProperties(properties Properties) *ReportingDescriptor

WithProperties specifies properties for a rule and returns the updated rule

func (*ReportingDescriptor) WithShortDescription added in v1.1.0

func (rule *ReportingDescriptor) WithShortDescription(description *MultiformatMessageString) *ReportingDescriptor

WithShortDescription specifies short description for a rule and returns the updated rule. Short description should be a single sentence that is understandable when visible space is limited to a single line of text.

type ReportingDescriptorReference added in v1.0.0

type ReportingDescriptorReference struct {
	PropertyBag
	Id            *string                 `json:"id,omitempty"`
	Index         *uint                   `json:"index,omitempty"`
	Guid          *string                 `json:"guid,omitempty"`
	ToolComponent *ToolComponentReference `json:"toolComponent,omitempty"`
}

func NewReportingDescriptorReference added in v1.0.0

func NewReportingDescriptorReference() *ReportingDescriptorReference

func (*ReportingDescriptorReference) WithGuid added in v1.0.0

func (*ReportingDescriptorReference) WithId added in v1.0.0

func (*ReportingDescriptorReference) WithIndex added in v1.0.0

func (*ReportingDescriptorReference) WithToolComponentReference added in v1.0.0

func (r *ReportingDescriptorReference) WithToolComponentReference(toolComponentRef *ToolComponentReference) *ReportingDescriptorReference

type Result added in v1.0.0

type Result struct {
	PropertyBag
	Guid            *string                         `json:"guid,omitempty"`
	CorrelationGuid *string                         `json:"correlationGuid,omitempty"`
	RuleID          *string                         `json:"ruleId,omitempty"`
	RuleIndex       *uint                           `json:"ruleIndex,omitempty"`
	Rule            *ReportingDescriptorReference   `json:"rule,omitempty"`
	Taxa            []*ReportingDescriptorReference `json:"taxa,omitempty"`
	Kind            *string                         `json:"kind,omitempty"`
	Level           *string                         `json:"level,omitempty"`
	Message         Message                         `json:"message"`
	Locations       []*Location                     `json:"locations,omitempty"`
	AnalysisTarget  *ArtifactLocation               `json:"analysisTarget,omitempty"`
	// WebRequest			*webRequest						`json:"webRequest,omitempty"`
	// WebResponse			*webResponse					`json:"webResponse,omitempty"`
	Fingerprints        map[string]interface{} `json:"fingerprints,omitempty"`
	PartialFingerprints map[string]interface{} `json:"partialFingerprints,omitempty"`
	// CodeFlows			[]*codeFlows					`json:"codeFlows,omitempty"`
	// Graphs				[]*graphs						`json:"graphs,omitempty"`
	// GraphTraversals		[]*graphTraversals				`json:"graphTraversals,omitempty"`
	// Stacks				[]*stack						`json:"stacks,omitempty"`
	RelatedLocations []*Location    `json:"relatedLocations,omitempty"`
	Suppressions     []*Suppression `json:"suppressions,omitempty"`
	BaselineState    *string        `json:"baselineState,omitempty"`
	Rank             *float32       `json:"rank,omitempty"`
	// Attachments			[]*attachment					`json:"attachments,omitempty"`
	WorkItemUris    []string `json:"workItemUris,omitempty"` // can be null
	HostedViewerUri *string  `json:"hostedViewerUri,omitempty"`
	// Provenance			*resultProvenance				`json:"provenance,omitempty"`
	Fixes           []*Fix     `json:"fixes,omitempty"`
	OccurrenceCount *uint      `json:"occurrenceCount,omitempty"`
	Properties      Properties `json:"properties,omitempty"`
}

Result represents the results block in the sarif report

func (*Result) AttachPropertyBag added in v1.0.9

func (r *Result) AttachPropertyBag(pb *PropertyBag)

AttachPropertyBag adds a property bag to a rule

func (*Result) WithAnalysisTarget added in v1.0.0

func (r *Result) WithAnalysisTarget(target *ArtifactLocation) *Result

func (*Result) WithBaselineState added in v1.0.0

func (r *Result) WithBaselineState(state string) *Result

func (*Result) WithCorrelationGuid added in v1.0.0

func (r *Result) WithCorrelationGuid(correlationGuid string) *Result

func (*Result) WithFingerPrints added in v1.0.0

func (r *Result) WithFingerPrints(fingerPrints map[string]interface{}) *Result

func (*Result) WithFix added in v1.0.0

func (r *Result) WithFix(fix *Fix) *Result

func (*Result) WithGuid added in v1.0.0

func (r *Result) WithGuid(guid string) *Result

func (*Result) WithHostedViewerUri added in v1.0.0

func (r *Result) WithHostedViewerUri(hostedViewerUri string) *Result

func (*Result) WithKind added in v1.0.0

func (r *Result) WithKind(kind string) *Result

func (*Result) WithLevel added in v1.0.0

func (r *Result) WithLevel(level string) *Result

func (*Result) WithLocation added in v1.0.0

func (r *Result) WithLocation(location *Location) *Result

func (*Result) WithMessage added in v1.0.0

func (r *Result) WithMessage(message *Message) *Result

func (*Result) WithOccurrenceCount added in v1.0.0

func (r *Result) WithOccurrenceCount(occurrenceCount int) *Result

func (*Result) WithPartialFingerPrints added in v1.0.0

func (r *Result) WithPartialFingerPrints(fingerPrints map[string]interface{}) *Result

func (*Result) WithProperties added in v1.0.9

func (r *Result) WithProperties(properties Properties) *Result

WithProperties specifies properties for a rule and returns the updated rule

func (*Result) WithRank added in v1.0.0

func (r *Result) WithRank(rank float32) *Result

func (*Result) WithRelatedLocation added in v1.0.0

func (r *Result) WithRelatedLocation(location *Location) *Result

func (*Result) WithRule added in v1.0.0

func (r *Result) WithRule(rdp *ReportingDescriptorReference) *Result

func (*Result) WithRuleIndex added in v1.0.0

func (r *Result) WithRuleIndex(ruleIndex int) *Result

func (*Result) WithSuppression added in v1.0.0

func (r *Result) WithSuppression(suppression *Suppression) *Result

func (*Result) WithTaxa added in v1.0.0

func (r *Result) WithTaxa(rdp *ReportingDescriptorReference) *Result

func (*Result) WithWorkItemUri added in v1.0.0

func (r *Result) WithWorkItemUri(workItemUri string) *Result

type Run added in v1.0.0

type Run struct {
	PropertyBag
	Tool        Tool          `json:"tool"`
	Invocations []*Invocation `json:"invocations,omitempty"`
	Artifacts   []*Artifact   `json:"artifacts,omitempty"`
	Results     []*Result     `json:"results"`
	Properties  Properties    `json:"properties,omitempty"`
}

Run type represents a run of a tool

func NewRun added in v1.0.0

func NewRun(toolName, informationURI string) *Run

NewRun allows the creation of a new Run

func (*Run) AddArtifact added in v1.0.0

func (run *Run) AddArtifact() *Artifact

AddArtifact adds an artifact to the run and returns a pointer to it

func (*Run) AddDistinctArtifact added in v1.0.8

func (run *Run) AddDistinctArtifact(uri string) *Artifact

AddDistinctArtifact will handle deduplication of simple artifact additions

func (*Run) AddInvocation added in v1.0.1

func (run *Run) AddInvocation(executionSuccessful bool) *Invocation

AddInvocation adds an invocation to the run and returns a pointer to it

func (*Run) AddProperty added in v1.0.6

func (run *Run) AddProperty(key string, value cty.Value)

func (*Run) AddResult added in v1.0.0

func (run *Run) AddResult(ruleID string) *Result

AddResult returns an existing Result or creates a new one and returns a pointer to it

func (*Run) AddRule added in v1.0.0

func (run *Run) AddRule(ruleID string) *ReportingDescriptor

AddRule returns an existing ReportingDescriptor for the ruleID or creates a new ReportingDescriptor and returns a pointer to it

func (*Run) AttachPropertyBag added in v1.0.2

func (run *Run) AttachPropertyBag(pb *PropertyBag)

func (*Run) DedupeArtifacts added in v1.0.0

func (run *Run) DedupeArtifacts() error

func (*Run) GetResultByRuleId added in v1.0.0

func (run *Run) GetResultByRuleId(ruleId string) (*Result, error)

GetResultByRuleId finds the result for a ruleId and returns a pointer to it

func (*Run) GetRuleById added in v1.0.0

func (run *Run) GetRuleById(ruleId string) (*ReportingDescriptor, error)

GetRuleById finds a rule by a given rule ID and returns a pointer to it

type RunOption added in v1.0.2

type RunOption int
const IncludeEmptyResults RunOption = iota

type Suppression added in v1.0.0

type Suppression struct {
	PropertyBag
	Kind          string    `json:"kind"`
	Status        *string   `json:"status"`
	Location      *Location `json:"location"`
	Guid          *string   `json:"guid"`
	Justification *string   `json:"justification"`
}

func NewSuppression added in v1.0.0

func NewSuppression(kind string) *Suppression

func (*Suppression) WithGuid added in v1.0.0

func (s *Suppression) WithGuid(guid string) *Suppression

func (*Suppression) WithJustifcation added in v1.0.0

func (s *Suppression) WithJustifcation(justification string) *Suppression

func (*Suppression) WithLocation added in v1.0.0

func (s *Suppression) WithLocation(location *Location) *Suppression

func (*Suppression) WithStatus added in v1.0.0

func (s *Suppression) WithStatus(status string) *Suppression

type Tool added in v1.0.0

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

type ToolComponent added in v1.1.0

type ToolComponent struct {
	PropertyBag
	Name           string                 `json:"name"`
	Version        *string                `json:"version,omitempty"`
	InformationURI *string                `json:"informationUri"`
	Notifications  []*ReportingDescriptor `json:"notifications,omitempty"`
	Rules          []*ReportingDescriptor `json:"rules,omitempty"`
	Taxa           []*ReportingDescriptor `json:"taxa,omitempty"`
}

func (*ToolComponent) WithVersion added in v1.1.0

func (driver *ToolComponent) WithVersion(version string) *ToolComponent

WithVersion specifies tool version, in whatever format it natively provides. Returns updated driver.

type ToolComponentReference added in v1.0.0

type ToolComponentReference struct {
	PropertyBag
	Name  *string `json:"name"`
	Index *uint   `json:"index"`
	Guid  *string `json:"guid"`
}

func NewToolComponentReference added in v1.0.0

func NewToolComponentReference() *ToolComponentReference

func (*ToolComponentReference) WithGuid added in v1.0.0

func (*ToolComponentReference) WithIndex added in v1.0.0

func (t *ToolComponentReference) WithIndex(index int) *ToolComponentReference

func (*ToolComponentReference) WithName added in v1.0.0

type Version

type Version string

Version is the version of Sarif to use

const Version210 Version = "2.1.0"

Version210 represents Version210 of Sarif

Jump to

Keyboard shortcuts

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