Skip to content
Snippets Groups Projects
Verified Commit a63ea31b authored by Zizhan Zhou's avatar Zizhan Zhou Committed by GitLab
Browse files

Added Security Orchestration Policy Added policy to check...

Added Security Orchestration Policy     Added policy to check vulnerabilities_allowed property is within the range of smallint, had to refactor the code because RuboCop was giving warnings on cyclomatic complexity
parent 6ca095e2
No related branches found
No related tags found
1 merge request!148808Added New Rule to Fix Security Orchestration Policy
......@@ -568,7 +568,8 @@
"vulnerabilities_allowed": {
"description": "Specifies a number of vulnerabilities allowed before this rule is enforced.",
"type": "integer",
"minimum": 0
"minimum": 0,
"maximum": 32767
},
"severity_levels": {
"description": "Specifies a list of vulnerability security levels that should be concidered to enforce this policy. Possible values: `info`, `unknown`, `low`, `medium`, `high`, `critical`.",
......
......@@ -1241,6 +1241,30 @@
end
end
describe "vulnerabilities_allowed" do
context "when value is below the minimum" do
before do
rule[:vulnerabilities_allowed] = -1
end
specify do
expect(errors).to contain_exactly(
"property '/#{type}/0/rules/0/vulnerabilities_allowed' is invalid: error_type=minimum")
end
end
context "when value is above the maximum" do
before do
rule[:vulnerabilities_allowed] = 32768
end
specify do
expect(errors).to contain_exactly(
"property '/#{type}/0/rules/0/vulnerabilities_allowed' is invalid: error_type=maximum")
end
end
end
describe "vulnerability_age" do
before do
rule[:vulnerability_age] = vulnerability_age
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment