1
0
mirror of https://github.com/aquasecurity/kube-bench.git synced 2024-12-22 22:58:07 +00:00

Merge pull request #131 from philalex/fixBooleansComparaison-issue125

Fix booleans comparaison issue125
This commit is contained in:
Liz Rice 2018-05-15 11:57:44 +01:00 committed by GitHub
commit 82b1e05a32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,10 +80,22 @@ func (t *testItem) execute(s string) (result bool) {
switch t.Compare.Op {
case "eq":
result = flagVal == t.Compare.Value
value := strings.ToLower(flagVal)
// Do case insensitive comparaison for booleans ...
if value == "false" || value == "true" {
result = value == t.Compare.Value
} else {
result = flagVal == t.Compare.Value
}
case "noteq":
result = !(flagVal == t.Compare.Value)
value := strings.ToLower(flagVal)
// Do case insensitive comparaison for booleans ...
if value == "false" || value == "true" {
result = !(value == t.Compare.Value)
} else {
result = !(flagVal == t.Compare.Value)
}
case "gt":
a, b := toNumeric(flagVal, t.Compare.Value)