Documentation ¶
Index ¶
- func UniqueProbesEqual(findings []Finding, probes []string) bool
- type AnonymousFinding
- type FileType
- type Finding
- func FromBytes(content []byte, probeID string) (*Finding, error)
- func New(loc embed.FS, probeID string) (*Finding, error)
- func NewFalse(efs embed.FS, probeID, text string, loc *Location) (*Finding, error)
- func NewNotApplicable(efs embed.FS, probeID, text string, loc *Location) (*Finding, error)
- func NewNotAvailable(efs embed.FS, probeID, text string, loc *Location) (*Finding, error)
- func NewNotSupported(efs embed.FS, probeID, text string, loc *Location) (*Finding, error)
- func NewTrue(efs embed.FS, probeID, text string, loc *Location) (*Finding, error)
- func NewWith(efs embed.FS, probeID, text string, loc *Location, o Outcome) (*Finding, error)
- func (f *Finding) Anonymize() *AnonymousFinding
- func (f *Finding) WithLocation(loc *Location) *Finding
- func (f *Finding) WithMessage(text string) *Finding
- func (f *Finding) WithOutcome(o Outcome) *Finding
- func (f *Finding) WithPatch(patch *string) *Finding
- func (f *Finding) WithRemediationMetadata(values map[string]string) *Finding
- func (f *Finding) WithValue(k, v string) *Finding
- func (f *Finding) WithValues(values map[string]string) *Finding
- type Location
- type Outcome
- type Remediation
- type RemediationEffort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UniqueProbesEqual ¶
UniqueProbesEqual checks the probe names present in a list of findings and compare them against an expected list.
Types ¶
type AnonymousFinding ¶
AnonymousFinding is a finding without a corresponding probe ID.
type FileType ¶
type FileType int
FileType is the type of a file.
const ( // FileTypeNone must be `0`. FileTypeNone FileType = iota // FileTypeSource is for source code files. FileTypeSource // FileTypeBinary is for binary files. FileTypeBinary // FileTypeText is for text files. FileTypeText // FileTypeURL for URLs. FileTypeURL // FileTypeBinaryVerified for verified binary files. FileTypeBinaryVerified )
type Finding ¶
type Finding struct { Location *Location `json:"location,omitempty"` Remediation *Remediation `json:"remediation,omitempty"` Values map[string]string `json:"values,omitempty"` Probe string `json:"probe"` Message string `json:"message"` Outcome Outcome `json:"outcome"` // contains filtered or unexported fields }
Finding represents a finding.
func NewNotApplicable ¶
NewNotApplicable create a finding with a NotApplicable outcome and the desired location.
func NewNotAvailable ¶
NewNotAvailable create a finding with a NotAvailable outcome and the desired location.
func NewNotSupported ¶
NewNotSupported create a finding with a NotSupported outcome and the desired location.
func (*Finding) Anonymize ¶
func (f *Finding) Anonymize() *AnonymousFinding
Anonymize removes the probe ID and outcome from the finding. It is a temporary solution to integrate the code in the details without exposing too much information.
func (*Finding) WithLocation ¶
WithLocation adds a location to an existing finding. No copy is made.
func (*Finding) WithMessage ¶
WithMessage adds a message to an existing finding. No copy is made.
func (*Finding) WithOutcome ¶
WithOutcome adds an outcome to an existing finding. No copy is made.
func (*Finding) WithRemediationMetadata ¶
WithRemediationMetadata adds remediation metadata to an existing finding. No copy is made.
type Location ¶
type Location struct { LineStart *uint `json:"lineStart,omitempty"` LineEnd *uint `json:"lineEnd,omitempty"` Snippet *string `json:"snippet,omitempty"` Path string `json:"path"` Type FileType `json:"type"` }
Location represents the location of a finding.
type Outcome ¶
type Outcome string
Outcome is the result of a finding.
const ( // OutcomeFalse indicates the answer to the probe's question is "false" or "no". OutcomeFalse Outcome = "False" // OutcomeNotAvailable indicates an unavailable outcome, // typically because an API call did not return an answer. OutcomeNotAvailable Outcome = "NotAvailable" // OutcomeError indicates an errors while running. // The results could not be determined. OutcomeError Outcome = "Error" // OutcomeTrue indicates the answer to the probe's question is "true" or "yes". OutcomeTrue Outcome = "True" // OutcomeNotSupported indicates a non-supported outcome. OutcomeNotSupported Outcome = "NotSupported" // OutcomeNotApplicable indicates if a finding should not // be considered in evaluation. OutcomeNotApplicable Outcome = "NotApplicable" )
TODO(#2928): re-visit the finding definitions.
func (*Outcome) UnmarshalYAML ¶
UnmarshalYAML is a custom unmarshalling function to transform the string into an enum.
type Remediation ¶
type Remediation struct { // Patch for machines. Patch *string `json:"patch,omitempty"` // Text for humans. Text string `json:"text"` // Text in markdown format for humans. Markdown string `json:"markdown"` // Effort to remediate. Effort RemediationEffort `json:"effort"` }
Remediation represents the remediation for a finding.
type RemediationEffort ¶
type RemediationEffort int
RemediationEffort indicates the estimated effort necessary to remediate a finding.
const ( // RemediationEffortNone indicates a no remediation effort. RemediationEffortNone RemediationEffort = iota // RemediationEffortLow indicates a low remediation effort. RemediationEffortLow // RemediationEffortMedium indicates a medium remediation effort. RemediationEffortMedium // RemediationEffortHigh indicates a high remediation effort. RemediationEffortHigh )
func (*RemediationEffort) String ¶
func (r *RemediationEffort) String() string
String stringifies the enum.
func (*RemediationEffort) UnmarshalYAML ¶
func (r *RemediationEffort) UnmarshalYAML(n *yaml.Node) error
UnmarshalYAML is a custom unmarshalling function to transform the string into an enum.