Skip to content

Commit d1a88e3

Browse files
committed
feat(CSAF2.1): change test schema and names
1 parent 545770d commit d1a88e3

File tree

2 files changed

+7
-34
lines changed

2 files changed

+7
-34
lines changed

csaf_2_1/mandatoryTests/mandatoryTest_6_1_53.js

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,6 @@ const ajv = new Ajv()
1212
const inputSchema = /** @type {const} */ ({
1313
additionalProperties: true,
1414
properties: {
15-
document: {
16-
additionalProperties: true,
17-
properties: {
18-
tracking: {
19-
additionalProperties: true,
20-
properties: {
21-
revision_history: {
22-
elements: {
23-
additionalProperties: true,
24-
optionalProperties: {
25-
date: { type: 'string' },
26-
},
27-
},
28-
},
29-
},
30-
},
31-
},
32-
},
3315
vulnerabilities: {
3416
elements: {
3517
additionalProperties: true,
@@ -72,10 +54,10 @@ export function mandatoryTest_6_1_53(doc) {
7254
}
7355

7456
doc.vulnerabilities?.forEach((vulnerability, vulnerabilityIndex) => {
75-
const exploitDate = vulnerability.first_known_exploitation_dates || []
76-
exploitDate.forEach((exploit, exploitIdx) => {
77-
const date = exploit.date
78-
const exploitationDate = exploit.exploitation_date
57+
const exploitationDates = vulnerability.first_known_exploitation_dates || []
58+
exploitationDates.forEach((item, Index) => {
59+
const date = item.date
60+
const exploitationDate = item.exploitation_date
7961

8062
if (
8163
compareZonedDateTimes(
@@ -85,8 +67,9 @@ export function mandatoryTest_6_1_53(doc) {
8567
) {
8668
ctx.isValid = false
8769
ctx.errors.push({
88-
instancePath: `/vulnerabilities/${vulnerabilityIndex}/first_known_exploitation_dates/${exploitIdx}`,
89-
message: 'the "exploitation_date" is newer than the "date"',
70+
instancePath: `/vulnerabilities/${vulnerabilityIndex}/first_known_exploitation_dates/${Index}`,
71+
message:
72+
'the "exploitation_date" is newer than the "date" which states when that information was last updated',
9073
})
9174
}
9275
})

tests/csaf_2_1/mandatoryTest_6_1_53.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ describe('mandatoryTest_6_1_53', function () {
99
it('skips empty vulnerability', function () {
1010
assert.equal(
1111
mandatoryTest_6_1_53({
12-
document: {
13-
tracking: {
14-
revision_history: [],
15-
},
16-
},
1712
vulnerabilities: [
1813
{}, // should be ignored
1914
{
@@ -33,11 +28,6 @@ describe('mandatoryTest_6_1_53', function () {
3328
it('skips empty first_known_exploitation_date', function () {
3429
assert.equal(
3530
mandatoryTest_6_1_53({
36-
document: {
37-
tracking: {
38-
revision_history: [],
39-
},
40-
},
4131
vulnerabilities: [
4232
{
4333
first_known_exploitation_dates: [

0 commit comments

Comments
 (0)