mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 13:34:23 +01:00
fix(config): validate rules when [extend] is used (#1592)
This commit is contained in:
1 parent
87d96295d6
commit
d22371873b
5 files changed
+38
-15
No files matched your search
+3
-2
@@ -219,7 +219,8 @@ func (vc *ViperConfig) Translate() (Config, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if maxExtendDepth != extendDepth {
|
||||
currentExtendDepth := extendDepth
|
||||
if maxExtendDepth != currentExtendDepth {
|
||||
// disallow both usedefault and path from being set
|
||||
if c.Extend.Path != "" && c.Extend.UseDefault {
|
||||
return Config{}, errors.New("unable to load config due to extend.path and extend.useDefault being set")
|
||||
@@ -236,7 +237,7 @@ func (vc *ViperConfig) Translate() (Config, error) {
|
||||
}
|
||||
|
||||
// Validate the rules after everything has been assembled (including extended configs).
|
||||
if extendDepth == 0 {
|
||||
if currentExtendDepth == 0 {
|
||||
for _, rule := range c.Rules {
|
||||
if err := rule.Validate(); err != nil {
|
||||
return Config{}, err
|
||||
|
||||
Reference in new issue
Block a user