fix(CSAF2.1): #197 fix mandatoryTest_6_1_27.8 - #648
Conversation
ea490a4 to
a3db3e1
Compare
|
Coverage after merging fix/csaf-2.1_mandatory_test_6.1.27.8 into main
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Conflicts: # tests/csaf_2_1/oasis.js
|
Coverage after merging fix/csaf-2.1_mandatory_test_6.1.27.8 into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Conflicts: # csaf_2_1/mandatoryTests.js
|
Coverage after merging fix/csaf-2.1_mandatory_test_6.1.27.8 into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const groupProductMap = new Map() | ||
| /** @type {ProductGroup[] | undefined} */ | ||
| const productGroups = doc.product_tree?.product_groups | ||
| if (Array.isArray(productGroups)) { |
There was a problem hiding this comment.
I think most of the isArray statements are not necessary. This should be done in the Validation
| const vulnerabilities = doc.vulnerabilities | ||
| if (Array.isArray(vulnerabilities)) { | ||
| vulnerabilities.forEach((vulnerability, vulnerabilityIndex) => { | ||
| if (['ids', 'cve'].every((p) => vulnerability[p] === undefined)) { |
There was a problem hiding this comment.
Please use meaningful variable names, not p
| } | ||
| }) | ||
| } | ||
| return hadErrors |
There was a problem hiding this comment.
The result in oasis_csaf_tc-csaf_2_1-2024-6-1-27-08-02.result.json does not match to the result of the function
[
{
"instancePath": "/vulnerabilities/0/product_status/known_not_affected/0",
"message": "product id `CSAFPID-9080700` does not have a vulnerability id assigned nor a CVE or general vulnerability id is given"
},
{
"instancePath": "/vulnerabilities/0/product_status/known_not_affected/1",
"message": "product id `CSAFPID-9080701` does not have a vulnerability id assigned nor a CVE or general vulnerability id is given"
},
{
"instancePath": "/vulnerabilities/1/product_status/known_not_affected/3",
"message": "product id `CSAFPID-9080703` does not have a vulnerability id assigned nor a CVE or general vulnerability id is given"
},
{
"instancePath": "/vulnerabilities/2/product_status/known_not_affected/3",
"message": "product id `CSAFPID-9080703` does not have a vulnerability id assigned nor a CVE or general vulnerability id is given"
}
]
There was a problem hiding this comment.
Possible inconsistency between test case and expected result
I may be overlooking something or misunderstanding the intended behavior, but it seems that the test case oasis_csaf_tc-csaf_2_1-2024-6-1-27-08-02.json and the corresponding oasis_csaf_tc-csaf_2_1-2024-6-1-27-08-02.result.json do not match.
For the first vulnerability (/vulnerabilities/0/), the scenario is:
"product_ids": ["CSAFPID-9080702"]Validation against:
known_not_affected = [
"CSAFPID-9080700",
"CSAFPID-9080701",
"CSAFPID-9080702"
]Results in:
CSAFPID-9080700→ not covered → validation error at index 0CSAFPID-9080701→ not covered → validation error at index 1CSAFPID-9080702→ covered → no validation error
This produces 2 validation errors (indices 0 and 1).
However, the expected result.json only contains a validation error at index 2.
Possible solution
If the expected result is correct, the test case could instead reference the product group:
"group_ids": ["CSAFGID-1020300"]where CSAFGID-1020300 resolves to:
[
"CSAFPID-9080700",
"CSAFPID-9080701"
]Validation against the same known_not_affected list would then produce:
CSAFPID-9080700→ covered → OKCSAFPID-9080701→ covered → OKCSAFPID-9080702→ not covered → validation error at index 2
This results in 1 validation error (index 2), which matches the expected result.json.
Expected behavior
If the expected outcome is the one defined in result.json, it seems that the affected products should be resolved via the referenced product group rather than by referencing the single product directly.
Could you confirm whether this is an inconsistency in the test case or if I am missing some aspect of the intended validation logic?
|
Coverage after merging fix/csaf-2.1_mandatory_test_6.1.27.8 into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
No description provided.