response

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NoErrorCode means the error code hasn't been set
	NoErrorCode = iota
	// CloneError means we were unable to successfully clone the resource
	CloneError
	// ScanError means there was some issue scanning the cloned resource
	ScanError
	// ResourceCleanupError means we couldn't remove the resources that were cloned after a scan
	ResourceCleanupError
)
View Source
const (
	GeneralResultKind          = "General"
	GitCommitResultKind        = "GitCommit"
	JSONDataResultKind         = "JSONData"
	ContainerLayerResultKind   = "ContainerLayer"
	ContainerMetdataResultKind = "ContainerMetdata"
)

In the future we might have things like GitCommitMessage GithubPullRequest, etc

Variables

This section is empty.

Functions

This section is empty.

Types

type Contact

type Contact struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

Contact for some resource when available

type ErrorCode

type ErrorCode int

ErrorCode defined sthe set of error codes that can be set on a LeakTKError

type LeakTKError

type LeakTKError struct {
	Fatal   bool      `json:"fatal"`
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
}

LeakTKError expands a normal error to provide additional meta data

func (LeakTKError) Error

func (e LeakTKError) Error() string

Error is defined to implement the error interface

func (LeakTKError) String

func (e LeakTKError) String() string

String provides a string representation of the error

type Location

type Location struct {
	// This can be things like a commit or some other version control identifier
	Version string `json:"version"`
	Path    string `json:"path"`
	// If the start column isn't available it will be zero.
	Start Point `json:"start"`
	// If the end information isn't available it will be the same as the
	// start information but the column will be the end of the line
	End Point `json:"end"`
}

Location in the specific resource being scanned

type Point

type Point struct {
	Line   int `json:"line"`
	Column int `json:"column"`
}

Point just provides line & column coordinates for a Result in a text file

type Response

type Response struct {
	ID        string         `json:"id"`
	Logs      []logger.Entry `json:"logs"`
	RequestID string         `json:"request_id"`
	Results   []*Result      `json:"results"`
}

Response from the scanner with the scan results

func (*Response) String

func (r *Response) String() string

String renders a response structure to the JSON format

type Result

type Result struct {
	ID       string            `json:"id"`
	Kind     string            `json:"kind"`
	Secret   string            `json:"secret"`
	Match    string            `json:"match"`
	Context  string            `json:"context"`
	Entropy  float32           `json:"entropy"`
	Date     string            `json:"date"`
	Rule     Rule              `json:"rule"`
	Contact  Contact           `json:"contact"`
	Location Location          `json:"location"`
	Notes    map[string]string `json:"notes"`
}

Result of a scan

type Rule

type Rule struct {
	ID          string   `json:"id"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
}

Rule that triggered the result

Jump to

Keyboard shortcuts

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