Skip to content

Commit 54df5be

Browse files
committed
feat: add mandatory test 6.1.51
1 parent 573df9c commit 54df5be

File tree

5 files changed

+233
-98
lines changed

5 files changed

+233
-98
lines changed

README.md

Lines changed: 54 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
- [About The Project](#about-the-project)
44
- [Getting Started](#getting-started)
55
- [How to use](#how-to-use)
6-
- [Strict Mode](#strict-mode)
7-
- [API](#api)
8-
- [Interfaces](#interfaces)
9-
- CSAF 2.0
10-
- [Module `schemaTests.js`](#module-schematestsjs)
11-
- [Module `mandatoryTests.js`](#module-mandatorytestsjs)
12-
- [Module `optionalTests.js`](#module-optionaltestsjs)
13-
- [Module `informativeTests.js`](#module-informativetestsjs)
14-
- [Module `basic.js`](#module-basicjs)
15-
- [Module `extended.js`](#module-extendedjs)
16-
- [Module `full.js`](#module-fulljs)
17-
- CSAF 2.1 (experimental)
18-
- [Known Issues](#known-issues)
19-
- [Module `csaf_2_1/schemaTests.js`](#module-csaf_2_1schematestsjs)
20-
- [Module `csaf_2_1/mandatoryTests.js`](#module-csaf_2_1mandatorytestsjs)
21-
- [Module `csaf_2_1/recommendedTests.js`](#module-csaf_2_1recommendedtestsjs)
22-
- [Module `csaf_2_1/informativeTests.js`](#module-csaf_2_1informativetestsjs)
23-
- [Module `csaf_2_1/basic.js`](#module-csaf_2_1basicjs)
24-
- [Module `csaf_2_1/extended.js`](#module-csaf_2_1extendedjs)
25-
- [Module `csaf_2_1/full.js`](#module-csaf_2_1fulljs)
26-
- [Module `validate.js`](#module-validatejs)
27-
- [Module `validateStrict.js`](#module-validatestrictjs)
28-
- [Module `strip.js`](#module-stripjs)
29-
- [Module `cwe.js`](#module-cwejs)
6+
- [Strict Mode](#strict-mode)
7+
- [API](#api)
8+
- [Interfaces](#interfaces)
9+
- CSAF 2.0
10+
- [Module `schemaTests.js`](#module-schematestsjs)
11+
- [Module `mandatoryTests.js`](#module-mandatorytestsjs)
12+
- [Module `optionalTests.js`](#module-optionaltestsjs)
13+
- [Module `informativeTests.js`](#module-informativetestsjs)
14+
- [Module `basic.js`](#module-basicjs)
15+
- [Module `extended.js`](#module-extendedjs)
16+
- [Module `full.js`](#module-fulljs)
17+
- CSAF 2.1 (experimental)
18+
- [Known Issues](#known-issues)
19+
- [Module `csaf_2_1/schemaTests.js`](#module-csaf_2_1schematestsjs)
20+
- [Module `csaf_2_1/mandatoryTests.js`](#module-csaf_2_1mandatorytestsjs)
21+
- [Module `csaf_2_1/recommendedTests.js`](#module-csaf_2_1recommendedtestsjs)
22+
- [Module `csaf_2_1/informativeTests.js`](#module-csaf_2_1informativetestsjs)
23+
- [Module `csaf_2_1/basic.js`](#module-csaf_2_1basicjs)
24+
- [Module `csaf_2_1/extended.js`](#module-csaf_2_1extendedjs)
25+
- [Module `csaf_2_1/full.js`](#module-csaf_2_1fulljs)
26+
- [Module `validate.js`](#module-validatejs)
27+
- [Module `validateStrict.js`](#module-validatestrictjs)
28+
- [Module `strip.js`](#module-stripjs)
29+
- [Module `cwe.js`](#module-cwejs)
3030
- [Testing](#testing)
3131
- [Contributing](#contributing)
3232
- [Dependencies](#dependencies)
@@ -80,7 +80,8 @@ You can also include this library as a subtree in your repository.
8080

8181
### Managing Hunspell languages
8282

83-
A CSAF Document can contain a [language](https://docs.oasis-open.org/csaf/csaf/v2.0/cs02/csaf-v2.0-cs02.html#3216-document-property---language).
83+
A CSAF Document can contain
84+
a [language](https://docs.oasis-open.org/csaf/csaf/v2.0/cs02/csaf-v2.0-cs02.html#3216-document-property---language).
8485
For example, valid entries could be `en` or `en-US`. When running test 6.3.8 we
8586
try to match this language to the list of installed hunspell languages. If the
8687
region is specified (like in `en-US`) and the corresponding language is
@@ -147,19 +148,19 @@ To proceed this dangerous path, use the `validate` function.
147148

148149
```typescript
149150
interface Result {
150-
isValid: boolean
151-
warnings: Array<{ message: string; instancePath: string }>
152-
errors: Array<{ message: string; instancePath: string }>
153-
infos: Array<{ message: string; instancePath: string }>
151+
isValid: boolean
152+
warnings: Array<{ message: string; instancePath: string }>
153+
errors: Array<{ message: string; instancePath: string }>
154+
infos: Array<{ message: string; instancePath: string }>
154155
}
155156
```
156157

157158
```typescript
158159
interface TestResult {
159-
isValid?: boolean
160-
warnings?: Array<{ message: string; instancePath: string }>
161-
errors?: Array<{ message: string; instancePath: string }>
162-
infos?: Array<{ message: string; instancePath: string }>
160+
isValid?: boolean
161+
warnings?: Array<{ message: string; instancePath: string }>
162+
errors?: Array<{ message: string; instancePath: string }>
163+
infos?: Array<{ message: string; instancePath: string }>
163164
}
164165
```
165166

@@ -299,13 +300,15 @@ This module exports all tests included in `extended.js` and all informative test
299300
300301
### CSAF 2.1 (experimental)
301302
302-
**HEADS UP**: The feature set in this section is not stable nor complete yet and changes without introducing a major version update. Please use it with caution! As soon as it becomes stable this README will be updated.
303+
**HEADS UP**: The feature set in this section is not stable nor complete yet and changes without introducing a major
304+
version update. Please use it with caution! As soon as it becomes stable this README will be updated.
303305
304306
In CSAF 2.1 the "optional tests" have been renamed to "recommended tests".
305307
306308
#### Known Issues
307309
308-
The CVSS 4.0 computation is still under debate as it it unclear from the specification how to compute threatScore and environmentalScore.
310+
The CVSS 4.0 computation is still under debate as it it unclear from the specification how to compute threatScore and
311+
environmentalScore.
309312
310313
The following tests are not yet implemented and therefore missing:
311314
@@ -331,7 +334,6 @@ The following tests are not yet implemented and therefore missing:
331334
- Mandatory Test 6.1.48
332335
- Mandatory Test 6.1.49
333336
- Mandatory Test 6.1.50
334-
- Mandatory Test 6.1.51
335337
- Mandatory Test 6.1.52
336338
- Mandatory Test 6.1.53
337339
- Mandatory Test 6.1.54
@@ -435,6 +437,7 @@ export const mandatoryTest_6_1_38: DocumentTest
435437
export const mandatoryTest_6_1_39: DocumentTest
436438
export const mandatoryTest_6_1_40: DocumentTest
437439
export const mandatoryTest_6_1_41: DocumentTest
440+
export const mandatoryTest_6_1_51: DocumentTest
438441
```
439442
440443
[(back to top)](#bsi-csaf-validator-lib)
@@ -517,20 +520,21 @@ for more details.
517520
518521
### Module `strip.js`
519522
520-
This function strips empty nodes and nodes with errors. The `strict` option (default `true`) throws an error if an unknown test function was passed. See [Strict Mode](#strict-mode) for more details.
523+
This function strips empty nodes and nodes with errors. The `strict` option (default `true`) throws an error if an
524+
unknown test function was passed. See [Strict Mode](#strict-mode) for more details.
521525
522526
```typescript
523527
type StripFn = (
524-
tests: DocumentTest[],
525-
document: any,
526-
options?: { strict?: boolean }
528+
tests: DocumentTest[],
529+
document: any,
530+
options?: { strict?: boolean }
527531
) => Promise<{
528-
document: any
529-
strippedPaths: {
530-
instancePath: string
531-
message: string
532-
error: boolean
533-
}[]
532+
document: any
533+
strippedPaths: {
534+
instancePath: string
535+
message: string
536+
error: boolean
537+
}[]
534538
}>
535539

536540
export default StripFn
@@ -548,7 +552,8 @@ export const weaknesses: Array<{ id: string; name: string }>
548552
549553
## Testing
550554
551-
Tests are implemented using [mocha](https://mochajs.org/). The minimal supported Node.js version is **14**. They can be run using the following command:
555+
Tests are implemented using [mocha](https://mochajs.org/). The minimal supported Node.js version is **14**. They can be
556+
run using the following command:
552557
553558
```sh
554559
npm test
@@ -564,7 +569,8 @@ You can find our guidelines here [CONTRIBUTING.md](https://github.com/secvisogra
564569

565570
## Dependencies
566571

567-
For the complete list of dependencies please take a look at [package.json](https://github.com/secvisogram/csaf-validator-lib/blob/main/package.json)
572+
For the complete list of dependencies please take a look
573+
at [package.json](https://github.com/secvisogram/csaf-validator-lib/blob/main/package.json)
568574

569575
- [Ajv JSON schema validator](https://github.com/ajv-validator/ajv)
570576
- [JSON Schema formats for Ajv](https://github.com/ajv-validator/ajv-formats)

csaf_2_1/mandatoryTests.js

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
11
export {
2-
mandatoryTest_6_1_2,
3-
mandatoryTest_6_1_3,
4-
mandatoryTest_6_1_4,
5-
mandatoryTest_6_1_5,
6-
mandatoryTest_6_1_6,
7-
mandatoryTest_6_1_12,
8-
mandatoryTest_6_1_15,
9-
mandatoryTest_6_1_17,
10-
mandatoryTest_6_1_18,
11-
mandatoryTest_6_1_19,
12-
mandatoryTest_6_1_20,
13-
mandatoryTest_6_1_21,
14-
mandatoryTest_6_1_22,
15-
mandatoryTest_6_1_23,
16-
mandatoryTest_6_1_24,
17-
mandatoryTest_6_1_25,
18-
mandatoryTest_6_1_26,
19-
mandatoryTest_6_1_27_1,
20-
mandatoryTest_6_1_27_2,
21-
mandatoryTest_6_1_27_3,
22-
mandatoryTest_6_1_27_4,
23-
mandatoryTest_6_1_27_5,
24-
mandatoryTest_6_1_27_6,
25-
mandatoryTest_6_1_27_7,
26-
mandatoryTest_6_1_27_8,
27-
mandatoryTest_6_1_27_9,
28-
mandatoryTest_6_1_27_10,
29-
mandatoryTest_6_1_27_11,
30-
mandatoryTest_6_1_28,
31-
mandatoryTest_6_1_29,
32-
mandatoryTest_6_1_30,
33-
mandatoryTest_6_1_31,
34-
mandatoryTest_6_1_32,
35-
mandatoryTest_6_1_33,
2+
mandatoryTest_6_1_2,
3+
mandatoryTest_6_1_3,
4+
mandatoryTest_6_1_4,
5+
mandatoryTest_6_1_5,
6+
mandatoryTest_6_1_6,
7+
mandatoryTest_6_1_12,
8+
mandatoryTest_6_1_15,
9+
mandatoryTest_6_1_17,
10+
mandatoryTest_6_1_18,
11+
mandatoryTest_6_1_19,
12+
mandatoryTest_6_1_20,
13+
mandatoryTest_6_1_21,
14+
mandatoryTest_6_1_22,
15+
mandatoryTest_6_1_23,
16+
mandatoryTest_6_1_24,
17+
mandatoryTest_6_1_25,
18+
mandatoryTest_6_1_26,
19+
mandatoryTest_6_1_27_1,
20+
mandatoryTest_6_1_27_2,
21+
mandatoryTest_6_1_27_3,
22+
mandatoryTest_6_1_27_4,
23+
mandatoryTest_6_1_27_5,
24+
mandatoryTest_6_1_27_6,
25+
mandatoryTest_6_1_27_7,
26+
mandatoryTest_6_1_27_8,
27+
mandatoryTest_6_1_27_9,
28+
mandatoryTest_6_1_27_10,
29+
mandatoryTest_6_1_27_11,
30+
mandatoryTest_6_1_28,
31+
mandatoryTest_6_1_29,
32+
mandatoryTest_6_1_30,
33+
mandatoryTest_6_1_31,
34+
mandatoryTest_6_1_32,
35+
mandatoryTest_6_1_33,
3636
} from '../mandatoryTests.js'
37-
export { mandatoryTest_6_1_1 } from './mandatoryTests/mandatoryTest_6_1_1.js'
38-
export { mandatoryTest_6_1_7 } from './mandatoryTests/mandatoryTest_6_1_7.js'
39-
export { mandatoryTest_6_1_8 } from './mandatoryTests/mandatoryTest_6_1_8.js'
40-
export { mandatoryTest_6_1_11 } from './mandatoryTests/mandatoryTest_6_1_11.js'
41-
export { mandatoryTest_6_1_13 } from './mandatoryTests/mandatoryTest_6_1_13.js'
42-
export { mandatoryTest_6_1_10 } from './mandatoryTests/mandatoryTest_6_1_10.js'
43-
export { mandatoryTest_6_1_34 } from './mandatoryTests/mandatoryTest_6_1_34.js'
44-
export { mandatoryTest_6_1_35 } from './mandatoryTests/mandatoryTest_6_1_35.js'
45-
export { mandatoryTest_6_1_9 } from './mandatoryTests/mandatoryTest_6_1_9.js'
46-
export { mandatoryTest_6_1_36 } from './mandatoryTests/mandatoryTest_6_1_36.js'
47-
export { mandatoryTest_6_1_37 } from './mandatoryTests/mandatoryTest_6_1_37.js'
48-
export { mandatoryTest_6_1_38 } from './mandatoryTests/mandatoryTests_6_1_38.js'
49-
export { mandatoryTest_6_1_39 } from './mandatoryTests/mandatoryTest_6_1_39.js'
50-
export { mandatoryTest_6_1_40 } from './mandatoryTests/mandatoryTest_6_1_40.js'
51-
export { mandatoryTest_6_1_41 } from './mandatoryTests/mandatoryTest_6_1_41.js'
37+
export {mandatoryTest_6_1_1} from './mandatoryTests/mandatoryTest_6_1_1.js'
38+
export {mandatoryTest_6_1_7} from './mandatoryTests/mandatoryTest_6_1_7.js'
39+
export {mandatoryTest_6_1_8} from './mandatoryTests/mandatoryTest_6_1_8.js'
40+
export {mandatoryTest_6_1_9} from './mandatoryTests/mandatoryTest_6_1_9.js'
41+
export {mandatoryTest_6_1_11} from './mandatoryTests/mandatoryTest_6_1_11.js'
42+
export {mandatoryTest_6_1_13} from './mandatoryTests/mandatoryTest_6_1_13.js'
43+
export {mandatoryTest_6_1_10} from './mandatoryTests/mandatoryTest_6_1_10.js'
44+
export {mandatoryTest_6_1_34} from './mandatoryTests/mandatoryTest_6_1_34.js'
45+
export {mandatoryTest_6_1_35} from './mandatoryTests/mandatoryTest_6_1_35.js'
46+
export {mandatoryTest_6_1_36} from './mandatoryTests/mandatoryTest_6_1_36.js'
47+
export {mandatoryTest_6_1_37} from './mandatoryTests/mandatoryTest_6_1_37.js'
48+
export {mandatoryTest_6_1_38} from './mandatoryTests/mandatoryTests_6_1_38.js'
49+
export {mandatoryTest_6_1_39} from './mandatoryTests/mandatoryTest_6_1_39.js'
50+
export {mandatoryTest_6_1_40} from './mandatoryTests/mandatoryTest_6_1_40.js'
51+
export {mandatoryTest_6_1_41} from './mandatoryTests/mandatoryTest_6_1_41.js'
52+
export {mandatoryTest_6_1_51} from './mandatoryTests/mandatoryTest_6_1_51.js'

0 commit comments

Comments
 (0)