mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 21:24:21 +01:00
Whitelist repo (#378)
* fixing commit latest bug * bumping go-git and adding repo whitelist * adding tests
This commit is contained in:
1 parent
8bd4649b01
commit
473d0d55a7
12 files changed
+282
-65
No files matched your search
@@ -51,6 +51,7 @@ type Config struct {
|
||||
Commits []string
|
||||
Files []*regexp.Regexp
|
||||
Paths []*regexp.Regexp
|
||||
Repos []*regexp.Regexp
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +64,7 @@ type TomlLoader struct {
|
||||
Commits []string
|
||||
Files []string
|
||||
Paths []string
|
||||
Repos []string
|
||||
}
|
||||
Rules []struct {
|
||||
Description string
|
||||
@@ -210,6 +212,16 @@ func (tomlLoader TomlLoader) Parse() (Config, error) {
|
||||
}
|
||||
cfg.Whitelist.Paths = append(cfg.Whitelist.Paths, re)
|
||||
}
|
||||
|
||||
// global repo whitelists
|
||||
for _, wlRepo := range tomlLoader.Whitelist.Repos {
|
||||
re, err := regexp.Compile(wlRepo)
|
||||
if err != nil {
|
||||
return cfg, fmt.Errorf("problem loading config: %v", err)
|
||||
}
|
||||
cfg.Whitelist.Repos = append(cfg.Whitelist.Repos, re)
|
||||
}
|
||||
|
||||
cfg.Whitelist.Commits = tomlLoader.Whitelist.Commits
|
||||
cfg.Whitelist.Description = tomlLoader.Whitelist.Description
|
||||
|
||||
|
||||
Reference in new issue
Block a user