working tests out

This commit is contained in:
zach rice committed 2019-04-13 12:30:00 -05:00
1 parent 256ace38d7
commit 7bd55e33b5
10 files changed
+144 -141

No files matched your search

+18 -14
View File
@@ -25,6 +25,7 @@ type Rule struct {
severity string
tags []string
entropies []*entropyRange
entropyROI string
}
// TomlConfig is used for loading gitleaks configs from a toml file
@@ -35,6 +36,7 @@ type TomlConfig struct {
Entropies []string
Tags []string
Severity string
EntropyROI string
}
Whitelist struct {
Files []string
@@ -117,24 +119,26 @@ func (config *Config) update(tomlConfig TomlConfig) error {
severity: rule.Severity,
tags: rule.Tags,
entropies: ranges,
entropyROI: rule.EntropyROI,
}
config.Rules = append(config.Rules, r)
}
// set stand alone rules from opts
if opts.Entropy != 0.0 {
ranges, err := getEntropyRanges([]string{fmt.Sprintf("0.0-%s", opts.Entropy)})
if err != nil {
log.Fatalf("could not create entropy range for %s", opts.Entropy)
}
r := &Rule{
description: "Entropy ",
severity: "5",
tags: []string{"entropy"},
entropies: ranges,
}
config.Rules = append(config.Rules, r)
}
// // set stand alone rules from opts
// if opts.Entropy != 0.0 {
// ranges, err := getEntropyRanges([]string{fmt.Sprintf("0.0-%s", opts.Entropy)})
// if err != nil {
// log.Fatalf("could not create entropy range for %s", opts.Entropy)
// }
// r := &Rule{
// description: "Entropy ",
// severity: "5",
// tags: []string{"entropy"},
// entropies: ranges,
// entropyROI:
// }
// config.Rules = append(config.Rules, r)
// }
// set whitelists
config.WhiteList.commits = make(map[string]bool)