Documentation
¶
Index ¶
Constants ¶
const MaxObjectContentLen = 1024 * 5000
MaxObjectContentLen contains the maximum size for the content of an object.
Variables ¶
This section is empty.
Functions ¶
func GroupObjectsByMetadata ¶
Types ¶
type Exception ¶
type Exception struct {
Name string
// Regular expresion that should match the name of the rule.
Rule *regexp.Regexp
// Regular expresion that should match the name of the object.
Object *regexp.Regexp
// Number of line where the secret is found in the contect of the object.
Nline *int
// Regular expresion that should match the content of the object.
Content *regexp.Regexp
}
Represents an Exception. In order for a secret to be considered as exception all non-nill attributes should match with the secret information. That means it's considered like and AND statement.
func (*Exception) Run ¶
Run executes the exception into a secret to determine if it's an exception or not.
func (*Exception) SetContent ¶
SetContent sets the regular expresion that should match the content of the object.
type MetadataAttributes ¶
type MetadataAttributes struct {
// All objects with same value on this key has the same content. It's used
// to optimise the inspection.
PrimaryKey bool
}
Represents the attributes of metadata.
type MetadataData ¶
type MetadataData struct {
// contains filtered or unexported fields
}
Represents the metadata of an object.
type Object ¶
type Object struct {
Type string
SubType string
Name string
Content []byte
Metadata map[string]MetadataData
PrimaryKeyHash KeyHash
}
Represents an object.
func (*Object) GetMetadata ¶
SetMetadata gets a metadata value from the object.
func (*Object) GetMetadataAll ¶
GetMetadataAll gets a map that contains all metadata of the object.
func (*Object) GetPrimaryKeyHash ¶
GetPrimaryKeyHash returns the primary key hash of the object. This hash is calculated by using the information of all metadata marked as primary key.
func (*Object) SetMetadata ¶
func (o *Object) SetMetadata(key string, value string, attr MetadataAttributes) error
SetMetadata sets a metadata value for the object.
type Rule ¶
type Rule struct {
// Contains the name of the rule.
Name string
// Specifies if the rule is enabled or not.
Enabled bool
// All lines of the content are analised separatelly.
// For a line to be considered a secret it should match the Match regular
// expression and not match any of the regular expressions contained on the
// Unmacth array.
Match *regexp.Regexp
Unmatch []*regexp.Regexp
}
Represents a Rule.
func (*Rule) AddUnmatch ¶
AddUnmatch adds a refular expression into the unmatch list.
type Secret ¶
type Secret struct {
// Object in witch the secret is found.
Object *Object
// Rule that matches.
Rule *Rule
// Number of line in the content that contains the secret.
Nline int
// Content of the specific line.
Line string
// Specifies if this matches an exception too.
Exception bool
}
Represents a found secret.
func (*Secret) SetException ¶
SetException specifies that a found secret is an exception (of false positive).