-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first pass at adding exemptions * Update config.yaml * make config_test more reliable * add flag to disallow exemptions in dashboard * add disallow-exemptions flag to CLI * add comments * fix exemptions flag * fix alert on dashboard * minor style changes
- Loading branch information
Robert Brennan
authored
Oct 23, 2019
1 parent
b172f61
commit 2b15f11
Showing
16 changed files
with
575 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package config | ||
|
||
import ( | ||
"reflect" | ||
) | ||
|
||
// IsActionable determines whether a check is actionable given the current configuration | ||
func (conf *Configuration) IsActionable(subConf interface{}, ruleName, controllerName string) bool { | ||
ruleID := GetIDFromField(subConf, ruleName) | ||
subConfRef := reflect.ValueOf(subConf) | ||
severity, ok := reflect.Indirect(subConfRef).FieldByName(ruleName).Interface().(Severity) | ||
if ok && !severity.IsActionable() { | ||
return false | ||
} | ||
if conf.DisallowExemptions { | ||
return true | ||
} | ||
for _, example := range conf.Exemptions { | ||
for _, rule := range example.Rules { | ||
if rule != ruleID { | ||
continue | ||
} | ||
for _, controller := range example.ControllerNames { | ||
if controller == controllerName { | ||
return false | ||
} | ||
} | ||
} | ||
} | ||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.