-
Notifications
You must be signed in to change notification settings - Fork 9
feat: adapt mandatory test 6.1.11 for csaf 2.1 #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Should pass the test (valid example 4) as the weakness was called "Sensitive Information Accessible by Physical Probing of JTAG Interface" in 4.9
Should pass the test (valid example 5) as the weakness was called "System-on-Chip (SoC) Using Components without Unique, Immutable Identifiers" in 4.13.
Should fail the test (failing example 2) as the weakness was not present in 4.12 (but added in 4.13; see https://cwe.mitre.org/data/reports/diff_reports/v4.12_v4.13.html)
Should fail the test (failing example 4) as the weakness was called "System-on-Chip (SoC) Using Components without Unique, Immutable Identifiers" in 4.13. Did you just check against the latest version? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@domachine I guess you are missing the version
?
for (let i = 0; i < doc.vulnerabilities.length; ++i) { | ||
const vulnerability = doc.vulnerabilities[i] | ||
for (let j = 0; j < vulnerability.cwes.length; ++j) { | ||
const cwe = vulnerability.cwes.at(i) | ||
if (validateCWE(cwe)) { | ||
const entry = cwec.weaknesses.find((w) => w.id === cwe.id) | ||
if (!entry) { | ||
isValid = false | ||
errors.push({ | ||
instancePath: `/vulnerabilities/${i}/cwes/${j}/id`, | ||
message: 'no weakness with this id is recognized', | ||
}) | ||
continue | ||
} | ||
if (entry.name !== cwe.name) { | ||
isValid = false | ||
errors.push({ | ||
instancePath: `/vulnerabilities/${i}/cwes/${j}/name`, | ||
message: 'the name does not match the weakness with the given id', | ||
}) | ||
continue | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the version
considered?
43c7fee
to
47510f2
Compare
Okay, now I included all catalogues that are necessary for the tests. We should probably discuss in the meeting next week, how many catalogue versions should be embedded in the lib. |
47510f2
to
64bf3f2
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1-exclude-unimplemented-tests-from-test-suite
Coverage Report
|
64bf3f2
to
9238623
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
9238623
to
eb90422
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
@domachine To be conforming: all available. |
eb90422
to
5399bd4
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
@tschmidtb51 now I included all available cwe catalogues. I also rebased the branch on the branch with the new test script (#220) so that you can use this to run the test against individual csaf files. |
5399bd4
to
b38d58c
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a cwe, that contains DEPRECATED in name a valid cew? (see: oasis_csaf_tc-csaf_2_1-2024-6-1-11-13.json=
/** @type {Array<{ message: string; instancePath: string }>} */ | ||
const errors = [] | ||
let isValid = true | ||
debugger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove debugger statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
b38d58c
to
4062f49
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
4062f49
to
b8f9111
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
Should be addressed now: https://github.com/secvisogram/csaf-validator-lib/pull/211/files#diff-29c641a5d6c5ab8670725896043cdecfc264a29d9bde9718175f1baac2e1078bR79 |
b8f9111
to
bc8f6be
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
@tschmidtb51 Can you have a look here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file csaf/csaf_2.1/test/validator/data/mandatory/oasis_csaf_tc-csaf_2_1-2024-6-1-11-06.json
reports errors:
{
"tests": [
{
"isValid": false,
"errors": [
{
"instancePath": "/vulnerabilities/1/cwes/0/id",
"message": "no weakness with this id is recognized in CWE 4.13"
},
{
"instancePath": "/vulnerabilities/1/cwes/1/id",
"message": "no weakness with this id is recognized in CWE 4.13"
}
],
"warnings": [],
"infos": [],
"name": "mandatoryTest_6_1_11"
}
],
"isValid": false
}
If I looked it up correctly, CWE-645
is valid (but reported). The other one is fine. What am I missing?
id: 'CWE-644', | ||
name: 'Improper Neutralization of HTTP Headers for Scripting Syntax', | ||
}, | ||
{ id: 'CWE-645', name: 'Overly Restrictive Account Lockout Mechanism' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CWE also exists here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much. That was indeed an index bug. I just fixed it.
isValid = false | ||
errors.push({ | ||
instancePath: `/vulnerabilities/${i}/cwes/${j}/name`, | ||
message: 'the name does not match the weakness with the given id', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the name could be present in a different version, I guess we should be more specific:
message: 'the name does not match the weakness with the given id', | |
message: 'the name does not match the weakness with the given id in CWE ${cwe.version}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I changed that.
bc8f6be
to
2d3e54f
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
2d3e54f
to
9d595af
Compare
9d595af
to
9c411b0
Compare
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
Coverage after merging 197-mandatory-test-6.1.11 into 196-csaf-2.1
Coverage Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Potentially invalid test cases:
All of the above test cases fail against the new test. I checked them manually and I think that they are invalid.