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

Do case insensitive comparaison for booleans - Fix #125

This commit is contained in:
Philippe ALEXANDRE 2018-05-15 11:48:49 +02:00
parent c808d9527d
commit c4e7487ba7

View File

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