finding

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotExistError added in v0.1.4

func IsNotExistError(err error) bool

func WrapNotExistError added in v0.1.4

func WrapNotExistError(err error) error

WrapNotExistError wraps an existing error into a NotExistError to hint on disabling the sandbox when the error is handled.

Types

type ErrorDetails

type ErrorDetails struct {
	ID           string          `json:"id,omitempty"`
	Name         string          `json:"name,omitempty"`
	Description  string          `json:"description,omitempty"`
	Severity     *Severity       `json:"severity,omitempty"`
	Mitigation   string          `json:"mitigation,omitempty"`
	Links        []Link          `json:"links,omitempty"`
	OwaspDetails *ExternalDetail `json:"owasp_details,omitempty"`
	CweDetails   *ExternalDetail `json:"cwe_details,omitempty"`
}

type ErrorType

type ErrorType string
const (
	ErrorTypeUnknownError     ErrorType = "UNKNOWN_ERROR"
	ErrorTypeCompilationError ErrorType = "COMPILATION_ERROR"
	ErrorTypeCrash            ErrorType = "CRASH"
	ErrorTypeWarning          ErrorType = "WARNING"
	ErrorTypeRuntimeError     ErrorType = "RUNTIME_ERROR"
)

These constants must have this exact value (in uppercase) to be able to parse JSON-marshalled reports as protobuf reports which use an enum for this field.

type ExternalDetail added in v0.20.0

type ExternalDetail struct {
	ID          int64  `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type Finding

type Finding struct {
	Name               string        `json:"name,omitempty"`
	Type               ErrorType     `json:"type,omitempty"`
	InputData          []byte        `json:"input_data,omitempty"`
	Logs               []string      `json:"logs,omitempty"`
	Details            string        `json:"details,omitempty"`
	HumanReadableInput string        `json:"human_readable_input,omitempty"`
	MoreDetails        *ErrorDetails `json:"more_details,omitempty"`
	Tag                uint64        `json:"tag,omitempty"`

	// Note: The following fields don't exist in the protobuf
	// representation used in the Code Intelligence core repository.
	CreatedAt  time.Time                `json:"created_at,omitempty"`
	InputFile  string                   `json:"input_file,omitempty"`
	StackTrace []*stacktrace.StackFrame `json:"stack_trace,omitempty"`

	// We also store the name of the fuzz test that found this finding so that
	// we can show it in the finding overview.
	FuzzTest string `json:"fuzz_test,omitempty"`
	// contains filtered or unexported fields
}

func ListFindings added in v0.1.4

func ListFindings(projectDir string, errorDetails *[]ErrorDetails) ([]*Finding, error)

ListFindings parses the JSON files of all findings and returns the result.

func LoadFinding added in v0.1.4

func LoadFinding(projectDir, findingName string, errorDetails *[]ErrorDetails) (*Finding, error)

LoadFinding parses the JSON file of the specified finding and returns the result. If the specified finding does not exist, a NotExistError is returned. If the user is logged in, the error details are added to the finding.

func (*Finding) CopyInputFileAndUpdateFinding added in v0.13.0

func (f *Finding) CopyInputFileAndUpdateFinding(projectDir, seedCorpusDir string) error

CopyInputFileAndUpdateFinding copies the input file to the finding directory and the seed corpus directory and adjusts the finding logs accordingly.

func (*Finding) EnhanceWithErrorDetails added in v0.20.0

func (f *Finding) EnhanceWithErrorDetails(errorDetails *[]ErrorDetails)

EnhanceWithErrorDetails adds more details to the finding by parsing the error details file.

func (*Finding) Exists added in v0.1.5

func (f *Finding) Exists(projectDir string) (bool, error)

Exists returns whether the JSON file of this finding already exists

func (*Finding) GetDetails

func (f *Finding) GetDetails() string

func (*Finding) GetSeedPath added in v0.1.5

func (f *Finding) GetSeedPath() string

func (*Finding) Save

func (f *Finding) Save(projectDir string) error

func (*Finding) ShortDescription

func (f *Finding) ShortDescription() string

func (*Finding) ShortDescriptionColumns added in v0.5.0

func (f *Finding) ShortDescriptionColumns() []string

func (*Finding) ShortDescriptionWithName added in v0.5.0

func (f *Finding) ShortDescriptionWithName() string
type Link struct {
	Description string `json:"description,omitempty"`
	URL         string `json:"url,omitempty"`
}

type NotExistError added in v0.1.4

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

A NotExistError indicates that the specified finding does not exist

func (NotExistError) Error added in v0.1.4

func (e NotExistError) Error() string

func (NotExistError) Unwrap added in v0.1.4

func (e NotExistError) Unwrap() error

type Severity

type Severity struct {
	Level SeverityLevel `json:"description,omitempty"`
	Score float32       `json:"score,omitempty"`
}

type SeverityLevel added in v0.1.5

type SeverityLevel string
const (
	SeverityLevelCritical SeverityLevel = "CRITICAL"
	SeverityLevelHigh     SeverityLevel = "HIGH"
	SeverityLevelMedium   SeverityLevel = "MEDIUM"
	SeverityLevelLow      SeverityLevel = "LOW"
)

Jump to

Keyboard shortcuts

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