Skip to content

Commit fdfb320

Browse files
Merge pull request #181 from secvisogram/chore/dependency-updates
Chore/dependency updates
2 parents 8308688 + f1843bc commit fdfb320

20 files changed

+6509
-50
lines changed

backend/package-lock.json

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

csaf-validator-lib/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,6 @@ The following tests are not yet implemented and therefore missing:
313313
314314
- Mandatory Test 6.1.26
315315
- Mandatory Test 6.1.27.13
316-
- Mandatory Test 6.1.42
317-
- Mandatory Test 6.1.44
318316
- Mandatory Test 6.1.46
319317
- Mandatory Test 6.1.47
320318
- Mandatory Test 6.1.48
@@ -332,10 +330,6 @@ The following tests are not yet implemented and therefore missing:
332330
- Recommended Test 6.2.21
333331
- Recommended Test 6.2.24
334332
- Recommended Test 6.2.26
335-
- Recommended Test 6.2.27
336-
- Recommended Test 6.2.28
337-
- Recommended Test 6.2.29
338-
- Recommended Test 6.2.30
339333
- Recommended Test 6.2.31
340334
- Recommended Test 6.2.32
341335
- Recommended Test 6.2.33
@@ -429,7 +423,9 @@ export const mandatoryTest_6_1_38: DocumentTest
429423
export const mandatoryTest_6_1_39: DocumentTest
430424
export const mandatoryTest_6_1_40: DocumentTest
431425
export const mandatoryTest_6_1_41: DocumentTest
426+
export const mandatoryTest_6_1_42: DocumentTest
432427
export const mandatoryTest_6_1_43: DocumentTest
428+
export const mandatoryTest_6_1_44: DocumentTest
433429
export const mandatoryTest_6_1_45: DocumentTest
434430
export const mandatoryTest_6_1_51: DocumentTest
435431
export const mandatoryTest_6_1_52: DocumentTest
@@ -460,6 +456,10 @@ export const recommendedTest_6_2_18: DocumentTest
460456
export const recommendedTest_6_2_22: DocumentTest
461457
export const recommendedTest_6_2_23: DocumentTest
462458
export const recommendedTest_6_2_25: DocumentTest
459+
export const recommendedTest_6_2_27: DocumentTest
460+
export const recommendedTest_6_2_28: DocumentTest
461+
export const recommendedTest_6_2_29: DocumentTest
462+
export const recommendedTest_6_2_30: DocumentTest
463463
export const recommendedTest_6_2_43: DocumentTest
464464
```
465465
@@ -480,6 +480,7 @@ export const informativeTest_6_3_9: DocumentTest
480480
export const informativeTest_6_3_10: DocumentTest
481481
export const informativeTest_6_3_11: DocumentTest
482482
export const informativeTest_6_3_12: DocumentTest
483+
export const informativeTest_6_3_18: DocumentTest
483484
```
484485
485486
[(back to top)](#bsi-csaf-validator-lib)

csaf-validator-lib/csaf_2_1/informativeTests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ export { informativeTest_6_3_1 } from './informativeTests/informativeTest_6_3_1.
1212
export { informativeTest_6_3_2 } from './informativeTests/informativeTest_6_3_2.js'
1313
export { informativeTest_6_3_4 } from './informativeTests/informativeTest_6_3_4.js'
1414
export { informativeTest_6_3_12 } from './informativeTests/informativeTest_6_3_12.js'
15+
export { informativeTest_6_3_18 } from './informativeTests/informativeTest_6_3_18.js'
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import Ajv from 'ajv/dist/jtd.js'
2+
3+
const ajv = new Ajv()
4+
5+
/**
6+
* @typedef {object} MetricContent
7+
* @property {string} [qualitative_severity_rating]
8+
*/
9+
10+
/**
11+
* @typedef {object} Metric
12+
* @property {MetricContent} [content]
13+
* @property {Array<string>} [products]
14+
*/
15+
16+
const inputSchema = /** @type {const} */ ({
17+
additionalProperties: true,
18+
properties: {
19+
vulnerabilities: {
20+
elements: {
21+
additionalProperties: true,
22+
optionalProperties: {
23+
metrics: {
24+
elements: {
25+
additionalProperties: true,
26+
optionalProperties: {
27+
content: {
28+
additionalProperties: true,
29+
optionalProperties: {
30+
qualitative_severity_rating: {
31+
type: 'string',
32+
},
33+
},
34+
},
35+
},
36+
},
37+
},
38+
},
39+
},
40+
},
41+
},
42+
})
43+
44+
const validateInput = ajv.compile(inputSchema)
45+
46+
/**
47+
* For each item in metrics it MUST be tested that it does not use the qualitative severity rating.
48+
* @param {any} doc
49+
* @returns
50+
*/
51+
export function informativeTest_6_3_18(doc) {
52+
const ctx = {
53+
infos: /** @type {Array<{ message: string; instancePath: string }>} */ ([]),
54+
}
55+
56+
if (!validateInput(doc)) {
57+
return ctx
58+
}
59+
60+
const vulnerabilities = doc.vulnerabilities
61+
62+
vulnerabilities.forEach((vulnerability, vulnerabilityIndex) => {
63+
/** @type {Array<Metric> | undefined} */
64+
const metrics = vulnerability.metrics
65+
metrics?.forEach((metric, metricIndex) => {
66+
if (metric?.content?.qualitative_severity_rating) {
67+
ctx.infos.push({
68+
instancePath: `/vulnerabilities/${vulnerabilityIndex}/metrics/${metricIndex}/content/qualitative_severity_rating`,
69+
message: 'qualitative_severity_rating object is present',
70+
})
71+
}
72+
})
73+
})
74+
75+
return ctx
76+
}

csaf-validator-lib/csaf_2_1/mandatoryTests.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export { mandatoryTest_6_1_38 } from './mandatoryTests/mandatoryTests_6_1_38.js'
5858
export { mandatoryTest_6_1_39 } from './mandatoryTests/mandatoryTest_6_1_39.js'
5959
export { mandatoryTest_6_1_40 } from './mandatoryTests/mandatoryTest_6_1_40.js'
6060
export { mandatoryTest_6_1_41 } from './mandatoryTests/mandatoryTest_6_1_41.js'
61+
export { mandatoryTest_6_1_42 } from './mandatoryTests/mandatoryTest_6_1_42.js'
6162
export { mandatoryTest_6_1_43 } from './mandatoryTests/mandatoryTest_6_1_43.js'
63+
export { mandatoryTest_6_1_44 } from './mandatoryTests/mandatoryTest_6_1_44.js'
6264
export { mandatoryTest_6_1_45 } from './mandatoryTests/mandatoryTest_6_1_45.js'
6365
export { mandatoryTest_6_1_51 } from './mandatoryTests/mandatoryTest_6_1_51.js'
6466
export { mandatoryTest_6_1_52 } from './mandatoryTests/mandatoryTest_6_1_52.js'

0 commit comments

Comments
 (0)