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:
parent
c808d9527d
commit
c4e7487ba7
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user