mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 13:34:23 +01:00
fix(rule): comment out errant validation case (#1509)
This should be re-enabled once a more suitable fix is implemented.
This commit is contained in:
1 parent
1a6d2b0a7a
commit
128cd22f7c
2 files changed
+10
-8
No files matched your search
@@ -91,11 +91,11 @@ func TestTranslate(t *testing.T) {
|
|||||||
cfg: Config{},
|
cfg: Config{},
|
||||||
wantError: fmt.Errorf("rule |id| is missing or empty, regex: (?i)(discord[a-z0-9_ .\\-,]{0,25})(=|>|:=|\\|\\|:|<=|=>|:).{0,5}['\\\"]([a-h0-9]{64})['\\\"]"),
|
wantError: fmt.Errorf("rule |id| is missing or empty, regex: (?i)(discord[a-z0-9_ .\\-,]{0,25})(=|>|:=|\\|\\|:|<=|=>|:).{0,5}['\\\"]([a-h0-9]{64})['\\\"]"),
|
||||||
},
|
},
|
||||||
{
|
//{
|
||||||
cfgName: "no_regex_or_path",
|
// cfgName: "no_regex_or_path",
|
||||||
cfg: Config{},
|
// cfg: Config{},
|
||||||
wantError: fmt.Errorf("discord-api-key: both |regex| and |path| are empty, this rule will have no effect"),
|
// wantError: fmt.Errorf("discord-api-key: both |regex| and |path| are empty, this rule will have no effect"),
|
||||||
},
|
//},
|
||||||
{
|
{
|
||||||
cfgName: "bad_entropy_group",
|
cfgName: "bad_entropy_group",
|
||||||
cfg: Config{},
|
cfg: Config{},
|
||||||
|
|||||||
+5
-3
@@ -60,10 +60,12 @@ func (r Rule) Validate() error {
|
|||||||
return fmt.Errorf("rule |id| is missing or empty" + context)
|
return fmt.Errorf("rule |id| is missing or empty" + context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: uncomment this once it works with |extend|.
|
||||||
|
// See: https://github.com/gitleaks/gitleaks/issues/1507#issuecomment-2352559213
|
||||||
// Ensure the rule actually matches something.
|
// Ensure the rule actually matches something.
|
||||||
if r.Regex == nil && r.Path == nil {
|
//if r.Regex == nil && r.Path == nil {
|
||||||
return fmt.Errorf("%s: both |regex| and |path| are empty, this rule will have no effect", r.RuleID)
|
// return fmt.Errorf("%s: both |regex| and |path| are empty, this rule will have no effect", r.RuleID)
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Ensure |secretGroup| works.
|
// Ensure |secretGroup| works.
|
||||||
if r.Regex != nil && r.SecretGroup > r.Regex.NumSubexp() {
|
if r.Regex != nil && r.SecretGroup > r.Regex.NumSubexp() {
|
||||||
|
|||||||
Reference in new issue
Block a user