Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "csaf-validator-lib/csaf"]
path = csaf-validator-lib/csaf
url = https://github.com/oasis-tcs/csaf.git
2 changes: 1 addition & 1 deletion backend/lib/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import config from 'config'
import { getHunspellAvailableLangs } from '../../csaf-validator-lib/hunspell.js'
import { getHunspellAvailableLangs } from '@secvisogram/csaf-validator-lib/hunspell.js'
import { openApiInfo } from './openApiInfo.js'

/**
Expand Down
8 changes: 4 additions & 4 deletions backend/lib/app/getTests.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as schemaTests from '../../../csaf-validator-lib/schemaTests.js'
import * as mandatoryTests from '../../../csaf-validator-lib/mandatoryTests.js'
import * as optionalTests from '../../../csaf-validator-lib/optionalTests.js'
import * as informativeTests from '../../../csaf-validator-lib/informativeTests.js'
import * as schemaTests from '@secvisogram/csaf-validator-lib/schemaTests.js'
import * as mandatoryTests from '@secvisogram/csaf-validator-lib/mandatoryTests.js'
import * as optionalTests from '@secvisogram/csaf-validator-lib/optionalTests.js'
import * as informativeTests from '@secvisogram/csaf-validator-lib/informativeTests.js'

const swaggerInfo = {
description:
Expand Down
18 changes: 9 additions & 9 deletions backend/lib/app/validate.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as schemaTests from '../../../csaf-validator-lib/schemaTests.js'
import * as mandatoryTests from '../../../csaf-validator-lib/mandatoryTests.js'
import * as optionalTests from '../../../csaf-validator-lib/optionalTests.js'
import * as informativeTests from '../../../csaf-validator-lib/informativeTests.js'
import * as basic from '../../../csaf-validator-lib/basic.js'
import * as extended from '../../../csaf-validator-lib/extended.js'
import * as full from '../../../csaf-validator-lib/full.js'
import validateStrict from '../../../csaf-validator-lib/validateStrict.js'
import * as schemaTests from '@secvisogram/csaf-validator-lib/schemaTests.js'
import * as mandatoryTests from '@secvisogram/csaf-validator-lib/mandatoryTests.js'
import * as optionalTests from '@secvisogram/csaf-validator-lib/optionalTests.js'
import * as informativeTests from '@secvisogram/csaf-validator-lib/informativeTests.js'
import * as basic from '@secvisogram/csaf-validator-lib/basic.js'
import * as extended from '@secvisogram/csaf-validator-lib/extended.js'
import * as full from '@secvisogram/csaf-validator-lib/full.js'
import validateStrict from '@secvisogram/csaf-validator-lib/validateStrict.js'

/** @type {Record<string, Parameters<typeof validateStrict>[0][number] | undefined>} */
const tests = Object.fromEntries(
Expand All @@ -30,7 +30,7 @@ const presets = {

const swaggerInfo = {
description:
'This endpoint is intended to validate a document against the specified tests. In the list of tests provide at least one object, where each object is used to run either a single test or an entire preset. For \'name\' provide the test\'s or the preset\'s name, and as \'type\' provide accordingly either \'test\' or \'preset\'. For the value of the property \'document\' just provide the json of your CSAF document.',
"This endpoint is intended to validate a document against the specified tests. In the list of tests provide at least one object, where each object is used to run either a single test or an entire preset. For 'name' provide the test's or the preset's name, and as 'type' provide accordingly either 'test' or 'preset'. For the value of the property 'document' just provide the json of your CSAF document.",
summary: 'Validate document.',
}

Expand Down
94 changes: 93 additions & 1 deletion backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@fastify/cors": "^11.0.0",
"@fastify/swagger": "^9.4.2",
"@fastify/swagger-ui": "^5.2.2",
"@secvisogram/csaf-validator-lib": "^2.0.23",
"close-with-grace": "^1.2.0",
"config": "^3.3.8",
"fastify": "^5.3.2"
Expand Down
64 changes: 32 additions & 32 deletions backend/tests/api.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { expect } from 'chai'
import { Agent, request, setGlobalDispatcher } from 'undici'
import * as schemaTests from '../../csaf-validator-lib/schemaTests.js'
import * as mandatoryTests from '../../csaf-validator-lib/mandatoryTests.js'
import * as optionalTests from '../../csaf-validator-lib/optionalTests.js'
import * as informativeTests from '../../csaf-validator-lib/informativeTests.js'
import * as basic from '../../csaf-validator-lib/basic.js'
import * as extended from '../../csaf-validator-lib/extended.js'
import * as full from '../../csaf-validator-lib/full.js'
import validate from '../../csaf-validator-lib/validate.js'
import * as schemaTests from '@secvisogram/csaf-validator-lib/schemaTests.js'
import * as mandatoryTests from '@secvisogram/csaf-validator-lib/mandatoryTests.js'
import * as optionalTests from '@secvisogram/csaf-validator-lib/optionalTests.js'
import * as informativeTests from '@secvisogram/csaf-validator-lib/informativeTests.js'
import * as basic from '@secvisogram/csaf-validator-lib/basic.js'
import * as extended from '@secvisogram/csaf-validator-lib/extended.js'
import * as full from '@secvisogram/csaf-validator-lib/full.js'
import validate from '@secvisogram/csaf-validator-lib/validate.js'
import { getConfig } from './shared/configData.js'
import { getValidSampleDocuments } from './shared/sampleDocumentsData.js'

Expand Down Expand Up @@ -73,35 +73,35 @@ describe('API', function () {

describe('OPTIONS /api/v1/tests', function () {
it('returns valid CORS information', async function () {
const res = await request(
'http://localhost:' + getConfig().port + '/api/v1/tests',
{
method: 'OPTIONS',
headers: {
'Origin': 'http://localhost',
'Access-Control-Request-Method': 'GET',
'Access-Control-Request-Headers': 'content-type'
}
}
)
expect(res.statusCode).to.equal(204)
const res = await request(
'http://localhost:' + getConfig().port + '/api/v1/tests',
{
method: 'OPTIONS',
headers: {
Origin: 'http://localhost',
'Access-Control-Request-Method': 'GET',
'Access-Control-Request-Headers': 'content-type',
},
}
)
expect(res.statusCode).to.equal(204)
})
})

describe('OPTIONS /api/v1/validate', function () {
it('returns valid CORS information', async function () {
const res = await request(
'http://localhost:' + getConfig().port + '/api/v1/validate',
{
method: 'OPTIONS',
headers: {
'Origin': 'http://localhost',
'Access-Control-Request-Method': 'POST',
'Access-Control-Request-Headers': 'content-type'
}
}
)
expect(res.statusCode).to.equal(204)
const res = await request(
'http://localhost:' + getConfig().port + '/api/v1/validate',
{
method: 'OPTIONS',
headers: {
Origin: 'http://localhost',
'Access-Control-Request-Method': 'POST',
'Access-Control-Request-Headers': 'content-type',
},
}
)
expect(res.statusCode).to.equal(204)
})
})

Expand Down
7 changes: 3 additions & 4 deletions backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */

/* Modules */
"module": "ES2020" /* Specify what module code is generated. */,
"module": "nodenext" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
// "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
Expand Down Expand Up @@ -97,6 +97,5 @@
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"references": [{ "path": "../csaf-validator-lib" }]
}
}
17 changes: 0 additions & 17 deletions csaf-validator-lib/.c8rc.json

This file was deleted.

13 changes: 0 additions & 13 deletions csaf-validator-lib/.github/dependabot.yml

This file was deleted.

Loading
Loading