message="Version #{report_version} for report type #{report_type} has been deprecated, supported versions for this report type are: #{supported_schema_versions}"
message="Report version not provided, #{report_type} report type supports versions: #{supported_schema_versions}"
add_message_as(level: treat_as,message: message)
else
message="Version #{report_version} for report type #{report_type} is unsupported, supported versions for this report type are: #{supported_schema_versions}"
"Version 12.37.0 for report type dast is unsupported, supported versions for this report type are: 14.0.0, 14.0.1, 14.0.2, 14.0.3, 14.0.4, 14.0.5, 14.0.6, 14.1.0"
]
end
it{is_expected.tomatch_array(expected_errors)}
end
context'and the report is invalid'do
let(:report_data)do
{
'version'=>report_version
}
end
let(:expected_errors)do
[
"Version 12.37.0 for report type dast is unsupported, supported versions for this report type are: 14.0.0, 14.0.1, 14.0.2, 14.0.3, 14.0.4, 14.0.5, 14.0.6, 14.1.0",
"root is missing required keys: vulnerabilities"
]
end
it{is_expected.tomatch_array(expected_errors)}
end
end
context'if enforce_security_report_validation is disabled'do
context'and the report passes schema validation'do
let(:report_data)do
{
'vulnerabilities'=>[]
}
end
let(:expected_warnings)do
[
"Version V2.7.0 for report type dast has been deprecated, supported versions for this report type are: 14.0.0, 14.0.1, 14.0.2, 14.0.3, 14.0.4, 14.0.5, 14.0.6, 14.1.0"
]
end
it{is_expected.tomatch_array(expected_warnings)}
end
context'and the report does not pass schema validation'do
context'and enforce_security_report_validation is enabled'do
"Version V2.7.0 for report type dast has been deprecated, supported versions for this report type are: 14.0.0, 14.0.1, 14.0.2, 14.0.3, 14.0.4, 14.0.5, 14.0.6, 14.1.0"
]
end
it{is_expected.tomatch_array(expected_warnings)}
end
context'and enforce_security_report_validation is disabled'do
"Version V2.7.0 for report type dast has been deprecated, supported versions for this report type are: 14.0.0, 14.0.1, 14.0.2, 14.0.3, 14.0.4, 14.0.5, 14.0.6, 14.1.0",
"property '/version' does not match pattern: ^[0-9]+\\.[0-9]+\\.[0-9]+$",
"root is missing required keys: vulnerabilities"
]
end
it{is_expected.tomatch_array(expected_warnings)}
end
end
end
context'when given an unsupported schema version'do
let(:report_type){:dast}
let(:report_version){"12.37.0"}
context'if enforce_security_report_validation is enabled'do
"Version 12.37.0 for report type dast is unsupported, supported versions for this report type are: 14.0.0, 14.0.1, 14.0.2, 14.0.3, 14.0.4, 14.0.5, 14.0.6, 14.1.0"
]
end
it{is_expected.tomatch_array(expected_warnings)}
end
context'and the report is invalid'do
let(:report_data)do
{
'version'=>report_version
}
end
let(:expected_warnings)do
[
"Version 12.37.0 for report type dast is unsupported, supported versions for this report type are: 14.0.0, 14.0.1, 14.0.2, 14.0.3, 14.0.4, 14.0.5, 14.0.6, 14.1.0",