Skip to content

feat: add mandatory test 6.1.51 #357

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 54 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@
- [About The Project](#about-the-project)
- [Getting Started](#getting-started)
- [How to use](#how-to-use)
- [Strict Mode](#strict-mode)
- [API](#api)
- [Interfaces](#interfaces)
- CSAF 2.0
- [Module `schemaTests.js`](#module-schematestsjs)
- [Module `mandatoryTests.js`](#module-mandatorytestsjs)
- [Module `optionalTests.js`](#module-optionaltestsjs)
- [Module `informativeTests.js`](#module-informativetestsjs)
- [Module `basic.js`](#module-basicjs)
- [Module `extended.js`](#module-extendedjs)
- [Module `full.js`](#module-fulljs)
- CSAF 2.1 (experimental)
- [Known Issues](#known-issues)
- [Module `csaf_2_1/schemaTests.js`](#module-csaf_2_1schematestsjs)
- [Module `csaf_2_1/mandatoryTests.js`](#module-csaf_2_1mandatorytestsjs)
- [Module `csaf_2_1/recommendedTests.js`](#module-csaf_2_1recommendedtestsjs)
- [Module `csaf_2_1/informativeTests.js`](#module-csaf_2_1informativetestsjs)
- [Module `csaf_2_1/basic.js`](#module-csaf_2_1basicjs)
- [Module `csaf_2_1/extended.js`](#module-csaf_2_1extendedjs)
- [Module `csaf_2_1/full.js`](#module-csaf_2_1fulljs)
- [Module `validate.js`](#module-validatejs)
- [Module `validateStrict.js`](#module-validatestrictjs)
- [Module `strip.js`](#module-stripjs)
- [Module `cwe.js`](#module-cwejs)
- [Strict Mode](#strict-mode)
- [API](#api)
- [Interfaces](#interfaces)
- CSAF 2.0
- [Module `schemaTests.js`](#module-schematestsjs)
- [Module `mandatoryTests.js`](#module-mandatorytestsjs)
- [Module `optionalTests.js`](#module-optionaltestsjs)
- [Module `informativeTests.js`](#module-informativetestsjs)
- [Module `basic.js`](#module-basicjs)
- [Module `extended.js`](#module-extendedjs)
- [Module `full.js`](#module-fulljs)
- CSAF 2.1 (experimental)
- [Known Issues](#known-issues)
- [Module `csaf_2_1/schemaTests.js`](#module-csaf_2_1schematestsjs)
- [Module `csaf_2_1/mandatoryTests.js`](#module-csaf_2_1mandatorytestsjs)
- [Module `csaf_2_1/recommendedTests.js`](#module-csaf_2_1recommendedtestsjs)
- [Module `csaf_2_1/informativeTests.js`](#module-csaf_2_1informativetestsjs)
- [Module `csaf_2_1/basic.js`](#module-csaf_2_1basicjs)
- [Module `csaf_2_1/extended.js`](#module-csaf_2_1extendedjs)
- [Module `csaf_2_1/full.js`](#module-csaf_2_1fulljs)
- [Module `validate.js`](#module-validatejs)
- [Module `validateStrict.js`](#module-validatestrictjs)
- [Module `strip.js`](#module-stripjs)
- [Module `cwe.js`](#module-cwejs)
- [Testing](#testing)
- [Contributing](#contributing)
- [Dependencies](#dependencies)
Expand Down Expand Up @@ -80,7 +80,8 @@ You can also include this library as a subtree in your repository.

### Managing Hunspell languages

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).
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).
For example, valid entries could be `en` or `en-US`. When running test 6.3.8 we
try to match this language to the list of installed hunspell languages. If the
region is specified (like in `en-US`) and the corresponding language is
Expand Down Expand Up @@ -147,19 +148,19 @@ To proceed this dangerous path, use the `validate` function.

```typescript
interface Result {
isValid: boolean
warnings: Array<{ message: string; instancePath: string }>
errors: Array<{ message: string; instancePath: string }>
infos: Array<{ message: string; instancePath: string }>
isValid: boolean
warnings: Array<{ message: string; instancePath: string }>
errors: Array<{ message: string; instancePath: string }>
infos: Array<{ message: string; instancePath: string }>
}
```

```typescript
interface TestResult {
isValid?: boolean
warnings?: Array<{ message: string; instancePath: string }>
errors?: Array<{ message: string; instancePath: string }>
infos?: Array<{ message: string; instancePath: string }>
isValid?: boolean
warnings?: Array<{ message: string; instancePath: string }>
errors?: Array<{ message: string; instancePath: string }>
infos?: Array<{ message: string; instancePath: string }>
}
```

Expand Down Expand Up @@ -299,13 +300,15 @@ This module exports all tests included in `extended.js` and all informative test

### CSAF 2.1 (experimental)

**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.
**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.

In CSAF 2.1 the "optional tests" have been renamed to "recommended tests".

#### Known Issues

The CVSS 4.0 computation is still under debate as it it unclear from the specification how to compute threatScore and environmentalScore.
The CVSS 4.0 computation is still under debate as it it unclear from the specification how to compute threatScore and
environmentalScore.

The following tests are not yet implemented and therefore missing:

Expand All @@ -331,7 +334,6 @@ The following tests are not yet implemented and therefore missing:
- Mandatory Test 6.1.48
- Mandatory Test 6.1.49
- Mandatory Test 6.1.50
- Mandatory Test 6.1.51
- Mandatory Test 6.1.52
- Mandatory Test 6.1.53
- Mandatory Test 6.1.54
Expand Down Expand Up @@ -435,6 +437,7 @@ export const mandatoryTest_6_1_38: DocumentTest
export const mandatoryTest_6_1_39: DocumentTest
export const mandatoryTest_6_1_40: DocumentTest
export const mandatoryTest_6_1_41: DocumentTest
export const mandatoryTest_6_1_51: DocumentTest
```

[(back to top)](#bsi-csaf-validator-lib)
Expand Down Expand Up @@ -517,20 +520,21 @@ for more details.

### Module `strip.js`

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.
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.

```typescript
type StripFn = (
tests: DocumentTest[],
document: any,
options?: { strict?: boolean }
tests: DocumentTest[],
document: any,
options?: { strict?: boolean }
) => Promise<{
document: any
strippedPaths: {
instancePath: string
message: string
error: boolean
}[]
document: any
strippedPaths: {
instancePath: string
message: string
error: boolean
}[]
}>

export default StripFn
Expand All @@ -548,7 +552,8 @@ export const weaknesses: Array<{ id: string; name: string }>

## Testing

Tests are implemented using [mocha](https://mochajs.org/). The minimal supported Node.js version is **14**. They can be run using the following command:
Tests are implemented using [mocha](https://mochajs.org/). The minimal supported Node.js version is **14**. They can be
run using the following command:

```sh
npm test
Expand All @@ -564,7 +569,8 @@ You can find our guidelines here [CONTRIBUTING.md](https://github.com/secvisogra

## Dependencies

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

- [Ajv JSON schema validator](https://github.com/ajv-validator/ajv)
- [JSON Schema formats for Ajv](https://github.com/ajv-validator/ajv-formats)
Expand Down
99 changes: 50 additions & 49 deletions csaf_2_1/mandatoryTests.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
export {
mandatoryTest_6_1_2,
mandatoryTest_6_1_3,
mandatoryTest_6_1_4,
mandatoryTest_6_1_5,
mandatoryTest_6_1_6,
mandatoryTest_6_1_12,
mandatoryTest_6_1_15,
mandatoryTest_6_1_17,
mandatoryTest_6_1_18,
mandatoryTest_6_1_19,
mandatoryTest_6_1_20,
mandatoryTest_6_1_21,
mandatoryTest_6_1_22,
mandatoryTest_6_1_23,
mandatoryTest_6_1_24,
mandatoryTest_6_1_25,
mandatoryTest_6_1_26,
mandatoryTest_6_1_27_1,
mandatoryTest_6_1_27_2,
mandatoryTest_6_1_27_3,
mandatoryTest_6_1_27_4,
mandatoryTest_6_1_27_5,
mandatoryTest_6_1_27_6,
mandatoryTest_6_1_27_7,
mandatoryTest_6_1_27_8,
mandatoryTest_6_1_27_9,
mandatoryTest_6_1_27_10,
mandatoryTest_6_1_27_11,
mandatoryTest_6_1_28,
mandatoryTest_6_1_29,
mandatoryTest_6_1_30,
mandatoryTest_6_1_31,
mandatoryTest_6_1_32,
mandatoryTest_6_1_33,
mandatoryTest_6_1_2,
mandatoryTest_6_1_3,
mandatoryTest_6_1_4,
mandatoryTest_6_1_5,
mandatoryTest_6_1_6,
mandatoryTest_6_1_12,
mandatoryTest_6_1_15,
mandatoryTest_6_1_17,
mandatoryTest_6_1_18,
mandatoryTest_6_1_19,
mandatoryTest_6_1_20,
mandatoryTest_6_1_21,
mandatoryTest_6_1_22,
mandatoryTest_6_1_23,
mandatoryTest_6_1_24,
mandatoryTest_6_1_25,
mandatoryTest_6_1_26,
mandatoryTest_6_1_27_1,
mandatoryTest_6_1_27_2,
mandatoryTest_6_1_27_3,
mandatoryTest_6_1_27_4,
mandatoryTest_6_1_27_5,
mandatoryTest_6_1_27_6,
mandatoryTest_6_1_27_7,
mandatoryTest_6_1_27_8,
mandatoryTest_6_1_27_9,
mandatoryTest_6_1_27_10,
mandatoryTest_6_1_27_11,
mandatoryTest_6_1_28,
mandatoryTest_6_1_29,
mandatoryTest_6_1_30,
mandatoryTest_6_1_31,
mandatoryTest_6_1_32,
mandatoryTest_6_1_33,
} from '../mandatoryTests.js'
export { mandatoryTest_6_1_1 } from './mandatoryTests/mandatoryTest_6_1_1.js'
export { mandatoryTest_6_1_7 } from './mandatoryTests/mandatoryTest_6_1_7.js'
export { mandatoryTest_6_1_8 } from './mandatoryTests/mandatoryTest_6_1_8.js'
export { mandatoryTest_6_1_11 } from './mandatoryTests/mandatoryTest_6_1_11.js'
export { mandatoryTest_6_1_13 } from './mandatoryTests/mandatoryTest_6_1_13.js'
export { mandatoryTest_6_1_10 } from './mandatoryTests/mandatoryTest_6_1_10.js'
export { mandatoryTest_6_1_34 } from './mandatoryTests/mandatoryTest_6_1_34.js'
export { mandatoryTest_6_1_35 } from './mandatoryTests/mandatoryTest_6_1_35.js'
export { mandatoryTest_6_1_9 } from './mandatoryTests/mandatoryTest_6_1_9.js'
export { mandatoryTest_6_1_36 } from './mandatoryTests/mandatoryTest_6_1_36.js'
export { mandatoryTest_6_1_37 } from './mandatoryTests/mandatoryTest_6_1_37.js'
export { mandatoryTest_6_1_38 } from './mandatoryTests/mandatoryTests_6_1_38.js'
export { mandatoryTest_6_1_39 } from './mandatoryTests/mandatoryTest_6_1_39.js'
export { mandatoryTest_6_1_40 } from './mandatoryTests/mandatoryTest_6_1_40.js'
export { mandatoryTest_6_1_41 } from './mandatoryTests/mandatoryTest_6_1_41.js'
export {mandatoryTest_6_1_1} from './mandatoryTests/mandatoryTest_6_1_1.js'
export {mandatoryTest_6_1_7} from './mandatoryTests/mandatoryTest_6_1_7.js'
export {mandatoryTest_6_1_8} from './mandatoryTests/mandatoryTest_6_1_8.js'
export {mandatoryTest_6_1_9} from './mandatoryTests/mandatoryTest_6_1_9.js'
export {mandatoryTest_6_1_11} from './mandatoryTests/mandatoryTest_6_1_11.js'
export {mandatoryTest_6_1_13} from './mandatoryTests/mandatoryTest_6_1_13.js'
export {mandatoryTest_6_1_10} from './mandatoryTests/mandatoryTest_6_1_10.js'
export {mandatoryTest_6_1_34} from './mandatoryTests/mandatoryTest_6_1_34.js'
export {mandatoryTest_6_1_35} from './mandatoryTests/mandatoryTest_6_1_35.js'
export {mandatoryTest_6_1_36} from './mandatoryTests/mandatoryTest_6_1_36.js'
export {mandatoryTest_6_1_37} from './mandatoryTests/mandatoryTest_6_1_37.js'
export {mandatoryTest_6_1_38} from './mandatoryTests/mandatoryTests_6_1_38.js'
export {mandatoryTest_6_1_39} from './mandatoryTests/mandatoryTest_6_1_39.js'
export {mandatoryTest_6_1_40} from './mandatoryTests/mandatoryTest_6_1_40.js'
export {mandatoryTest_6_1_41} from './mandatoryTests/mandatoryTest_6_1_41.js'
export {mandatoryTest_6_1_51} from './mandatoryTests/mandatoryTest_6_1_51.js'
Loading
Loading