secret

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FalsePositives []regexp.Regexp
View Source
var IgnoreList []regexp.Regexp
View Source
var Signatures = make(map[string]Signature)

Signatures holds a list of all signatures used during the session

Functions

func LoadSignatures

func LoadSignatures(content []byte, mLevel int, loadFromConfig bool) map[string]Signature

LoadSignatures will load all known signatures for the various match types into the session

Types

type File

type File struct {
	Reference file.Reference
	Reader    io.ReadCloser
}

Distro represents a Linux Distribution.

type PatternSignature

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

PatternSignature holds the information about a pattern signature which is a regex used to match content within a file

func (PatternSignature) Check

func (s PatternSignature) Check(path string, kind types.Type, contents []byte, showSecrets bool, secretChar string, secretRatio float64) []*sarif.Result

func (PatternSignature) ConfidenceLevel

func (s PatternSignature) ConfidenceLevel() int

ConfidenceLevel sets the confidence level of the pattern

func (PatternSignature) Description

func (s PatternSignature) Description() *string

Description sets the user comment of the signature

func (PatternSignature) Enable

func (s PatternSignature) Enable() int

Enable sets whether as signature is active or not

func (PatternSignature) SignatureID

func (s PatternSignature) SignatureID() *string

SignatureID sets the id used to identify the signature. This id is immutable and generated from a has of the signature and is changed with every update to a signature.

func (PatternSignature) SignaturePattern added in v0.0.4

func (s PatternSignature) SignaturePattern() *regexp.Regexp

SignaturePattern gets the pattern of the signature

type Secret

type Secret struct {
	Data     string
	Location string
}

Distro represents a Linux Distribution.

func (Secret) String

func (s Secret) String() string

String returns a human-friendly representation of the Linux distribution.

type SecretConfig added in v0.0.8

type SecretConfig struct {
	Name     string  `yaml:"name" json:"name"`
	Regex    string  `yaml:"regex" json:"regex"`
	Severity float64 `yaml:"severity" json:"severity,string"`
}

type Signature

type Signature interface {
	Description() *string
	Enable() int
	ConfidenceLevel() int
	SignatureID() *string
	Check(path string, kind types.Type, contents []byte, showSecrets bool, secretChar string, secretRatio float64) []*sarif.Result
	SignaturePattern() *regexp.Regexp
}

Signature is an expression that we are looking for in a file

type SignatureConfig

type SignatureConfig struct {
	Meta   SignaturesMetaData `yaml:"Meta"`
	Ignore []string           `yaml:"Ignore"`
	//PatternSignatures      []SignatureDef     `yaml:"PatternSignatures"`
	Signatures    []SignatureDef `yaml:"Signatures"`
	FalsePositive []string       `yaml:"FalsePositive"`
}

SignatureConfig holds the base file structure for the signatures file

type SignatureDef

type SignatureDef struct {
	Comment         string  `yaml:"comment" json:"comment"`
	Description     string  `yaml:"description" json:"description"`
	Enable          int     `yaml:"enable" json:"enable"`
	Entropy         float64 `yaml:"entropy" json:"entropy"`
	Match           string  `yaml:"match" json:"match"`
	ConfidenceLevel int     `yaml:"confidence-level" json:"confidence-level"`
	Severity        float64 `json:"severity,string"`
	Path            string  `yaml:"path" json:"path"`
	SignatureID     string  `yaml:"signatureid" json:"signatureid"`
}

SignatureDef maps to a signature within the yaml file

type SignaturesMetaData

type SignaturesMetaData struct {
	Date    string
	Time    int
	Version string
}

SignaturesMetaData is used by updateSignatures to determine if/how to update the signatures

Jump to

Keyboard shortcuts

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