mirror of
https://github.com/aquasecurity/kube-bench.git
synced 2024-12-22 22:58: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":
|
||||||
|
// Do case insensitive comparaison for booleans ...
|
||||||
|
if value == "false" || value == "true" {
|
||||||
|
result = value == t.Compare.Value
|
||||||
|
} else {
|
||||||
result = flagVal == t.Compare.Value
|
result = flagVal == t.Compare.Value
|
||||||
|
}
|
||||||
|
|
||||||
case "noteq":
|
case "noteq":
|
||||||
|
// Do case insensitive comparaison for booleans ...
|
||||||
|
if value == "false" || value == "true" {
|
||||||
|
result = !(value == t.Compare.Value)
|
||||||
|
} else {
|
||||||
result = !(flagVal == t.Compare.Value)
|
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