defect

package
v0.0.0-...-0c672af Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRelativeFilename

func GetRelativeFilename(fileName string, rootDir string) string

GetRelativeFilename returns filename relative to scan root directory

Types

type Defect

type Defect struct {
	Lines []int

	Tag            string
	AdditionalInfo string `yaml:"additional-info,omitempty"`
	// contains filtered or unexported fields
}

Defect represents a unique secret combination of a file and a unique secret

type File

type File struct {
	Filename string
}

File containing secret

type FileDefects

type FileDefects struct {
	Defects map[File][]*Defect
}

FileDefects is the mapping of files

func NewFileDefects

func NewFileDefects() FileDefects

NewFileDefects allocates FileDefects structure

func (*FileDefects) AddInstance

func (this *FileDefects) AddInstance(fileName string, secret secret.Secret) (defectInstance *Defect, newDefect bool)

AddInstance adds a new Defect structure when secret is the first occurrence detected in fileName. If secret is not the first occurrence found in fileName the Defect is modified to inlcude the additional line number where the secret was again detected.

type FileRepo

type FileRepo struct {
	ID       int64  `yaml:",omitempty"`          //Intialized for GithubFileRepository
	Org      string `yaml:",omitempty"`          //Intialized for GithubFileRepository
	Name     string `yaml:",omitempty"`          //Intialized for GithubFileRepository
	Branch   string `yaml:",omitempty"`          //Intialized for GithubFileRepository
	Head     string `yaml:",omitempty"`          //Intialized for GithubFileRepository
	LastPush string `yaml:"last-push,omitempty"` //Intialized for GithubFileRepository
	LocalDir string `yaml:",omitempty"`          //Intialized for LocalFileRepository
}

FileRepo documents the FileRepository scanned

type Report

type Report struct {
	Repositories map[FileRepo]FileDefects
	DefectCount  int
	// contains filtered or unexported fields
}

Report fully documents detected secrets and is written to the final output file

func NewDefectReport

func NewDefectReport(outputDir string) *Report

NewDefectReport initialzied a DefectReport structure used to maintain and report detected secrets

func (*Report) AddDefects

func (this *Report) AddDefects(currentRepo FileRepo, fileDefects FileDefects)

AddDefects adds a FileDefect collection to currentRepo

func (*Report) ReduceAndExploit

func (this *Report) ReduceAndExploit(secrets []secret.Secret, scanRoot string) FileDefects

ReduceAndExploit consolidates instances of the same secret and executes the optional Expoloit function specified in the configuration rule used to detect the Value.

func (*Report) Save

func (this *Report) Save()

Save outputs DefectReport to defectReport.yaml in the output directory specified on the command line

Jump to

Keyboard shortcuts

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