File tree Expand file tree Collapse file tree 4 files changed +55
-1
lines changed Expand file tree Collapse file tree 4 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -27,3 +27,4 @@ export { recommendedTest_6_2_8 } from './recommendedTests/recommendedTest_6_2_8.
27
27
export { recommendedTest_6_2_9 } from './recommendedTests/recommendedTest_6_2_9.js'
28
28
export { recommendedTest_6_2_3 } from './recommendedTests/recommendedTest_6_2_3.js'
29
29
export { recommendedTest_6_2_22 } from './recommendedTests/recommendedTest_6_2_22.js'
30
+ export { recommendedTest_6_2_38 } from './recommendedTests/recommendedTest_6_2_38.js'
Original file line number Diff line number Diff line change
1
+ import Ajv from 'ajv/dist/jtd.js'
2
+
3
+ const ajv = new Ajv ( )
4
+
5
+ const inputSchema = /** @type {const } */ ( {
6
+ additionalProperties : true ,
7
+ properties : {
8
+ document : {
9
+ additionalProperties : true ,
10
+ properties : {
11
+ category : { type : 'string' } ,
12
+ } ,
13
+ } ,
14
+ } ,
15
+ } )
16
+
17
+ const validate = ajv . compile ( inputSchema )
18
+
19
+ /**
20
+ * This implements the recommended test 6.2.38 of the CSAF 2.1 standard.
21
+ *
22
+ /**
23
+ * @param {any } doc
24
+ */
25
+ export function recommendedTest_6_2_38 ( doc ) {
26
+ /** @type {Array<{ message: string; instancePath: string }> } */
27
+ const warnings = [ ]
28
+ const context = { warnings }
29
+
30
+ if ( ! validate ( doc ) ) {
31
+ return context
32
+ }
33
+
34
+ if ( doc . document . category . match ( / ^ c s a f _ d e p r e c a t e d _ .* $ / ) ) {
35
+ context . warnings . push ( {
36
+ message :
37
+ 'The document category indicates the usage of a deprecated profile as it starts with "csaf_deprecated_"' ,
38
+ instancePath : '/document/category' ,
39
+ } )
40
+ }
41
+
42
+ return context
43
+ }
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ const excluded = [
63
63
'6.2.35' ,
64
64
'6.2.36' ,
65
65
'6.2.37' ,
66
- '6.2.38' ,
67
66
'6.2.39.1' ,
68
67
'6.2.39.2' ,
69
68
'6.2.39.3' ,
Original file line number Diff line number Diff line change
1
+ import assert from 'node:assert'
2
+ import { recommendedTest_6_2_38 } from '../../csaf_2_1/recommendedTests.js'
3
+
4
+ describe ( 'recommendedTest_6_2_38' , function ( ) {
5
+ it ( 'only runs on relevant documents' , function ( ) {
6
+ assert . equal (
7
+ recommendedTest_6_2_38 ( { vulnerabilities : 'mydoc' } ) . warnings . length ,
8
+ 0
9
+ )
10
+ } )
11
+ } )
You can’t perform that action at this time.
0 commit comments