mirror of
https://github.com/aquasecurity/kube-bench.git
synced 2024-12-18 12:48:08 +00:00
* issue #243: Changes condition so that score: false tests are performed * issue #243: Changes comments.
This commit is contained in:
parent
b86dd92c91
commit
86e3456f33
@ -60,18 +60,18 @@ func handleError(err error, context string) (errmsg string) {
|
|||||||
// Check contains information about a recommendation in the
|
// Check contains information about a recommendation in the
|
||||||
// CIS Kubernetes 1.6+ document.
|
// CIS Kubernetes 1.6+ document.
|
||||||
type Check struct {
|
type Check struct {
|
||||||
ID string `yaml:"id" json:"test_number"`
|
ID string `yaml:"id" json:"test_number"`
|
||||||
Text string `json:"test_desc"`
|
Text string `json:"test_desc"`
|
||||||
Audit string `json:"audit"`
|
Audit string `json:"audit"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Commands []*exec.Cmd `json:"omit"`
|
Commands []*exec.Cmd `json:"omit"`
|
||||||
Tests *tests `json:"omit"`
|
Tests *tests `json:"omit"`
|
||||||
Set bool `json:"omit"`
|
Set bool `json:"omit"`
|
||||||
Remediation string `json:"remediation"`
|
Remediation string `json:"remediation"`
|
||||||
TestInfo []string `json:"test_info"`
|
TestInfo []string `json:"test_info"`
|
||||||
State `json:"status"`
|
State `json:"status"`
|
||||||
ActualValue string `json:"actual_value"`
|
ActualValue string `json:"actual_value"`
|
||||||
Scored bool `json:"scored"`
|
Scored bool `json:"scored"`
|
||||||
ExpectedResult string `json:"expected_result"`
|
ExpectedResult string `json:"expected_result"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +102,8 @@ func (c *Check) run() State {
|
|||||||
return c.State
|
return c.State
|
||||||
}
|
}
|
||||||
|
|
||||||
// If check type is manual or the check is not scored, force result to WARN
|
// If check type is manual force result to WARN
|
||||||
if c.Type == "manual" || !c.Scored {
|
if c.Type == "manual" {
|
||||||
c.State = WARN
|
c.State = WARN
|
||||||
return c.State
|
return c.State
|
||||||
}
|
}
|
||||||
@ -193,7 +193,11 @@ func (c *Check) run() State {
|
|||||||
if finalOutput.testResult {
|
if finalOutput.testResult {
|
||||||
c.State = PASS
|
c.State = PASS
|
||||||
} else {
|
} else {
|
||||||
c.State = FAIL
|
if c.Scored {
|
||||||
|
c.State = FAIL
|
||||||
|
} else {
|
||||||
|
c.State = WARN
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errmsgs += handleError(
|
errmsgs += handleError(
|
||||||
|
Loading…
Reference in New Issue
Block a user