Skip to content

Commit

Permalink
fix: --security-revert=CVE-2023-46809
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Jun 30, 2024
1 parent 77676cb commit de9f147
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions projects/aas-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"scripts": {
"tsoa": "tsoa spec-and-routes",
"serve": "rimraf build && npm run tsoa && tsc -p tsconfig.app.json",
"test": "node --experimental-vm-modules --no-warnings ../../node_modules/jest/bin/jest.js -c jest.config.ts",
"test:debug": "node --experimental-vm-modules --no-warnings ../../node_modules/jest/bin/jest.js -c jest.config.js --runInBand --no-cache --verbose --watchAll=true",
"test": "node --experimental-vm-modules --no-warnings --security-revert=CVE-2023-46809 ../../node_modules/jest/bin/jest.js -c jest.config.ts",
"test:debug": "node --experimental-vm-modules --no-warnings --security-revert=CVE-2023-46809 ../../node_modules/jest/bin/jest.js -c jest.config.js --runInBand --no-cache --verbose --watchAll=true",
"build": "rimraf dist && npm run tsoa && node esbuild.prod.js",
"build:debug": "rimraf dist && npm run tsoa && node esbuild.dev.js",
"tsc": "rimraf build && tsc -p tsconfig.json",
Expand Down
18 changes: 9 additions & 9 deletions projects/aas-server/src/test/configuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { describe, it, expect } from '@jest/globals';
import { AASEndpoint } from 'common';
import { urlToEndpoint } from '../app/configuration.js';

describe('configuration', function () {
describe('urlToEndpoint', function () {
it('gets an endpoint from an URL string', function () {
describe('configuration', () => {
describe('urlToEndpoint', () => {
it('gets an endpoint from an URL string', () => {
expect(urlToEndpoint('http://localhost:1234/?name=Test')).toEqual({
name: 'Test',
url: 'http://localhost:1234/',
Expand All @@ -21,7 +21,7 @@ describe('configuration', function () {
} as AASEndpoint);
});

it('gets an endpoint from an URL', function () {
it('gets an endpoint from an URL', () => {
expect(urlToEndpoint(new URL('http://localhost:1234/?name=Test'))).toEqual({
name: 'Test',
url: 'http://localhost:1234/',
Expand All @@ -30,7 +30,7 @@ describe('configuration', function () {
} as AASEndpoint);
});

it('gets the endpoint name from a URL', function () {
it('gets the endpoint name from a URL', () => {
expect(urlToEndpoint('http://localhost:1234/?name=Test&version=v2')).toEqual({
name: 'Test',
url: 'http://localhost:1234/',
Expand All @@ -39,7 +39,7 @@ describe('configuration', function () {
} as AASEndpoint);
});

it('gets an endpoint of an AASX server', function () {
it('gets an endpoint of an AASX server', () => {
expect(urlToEndpoint('http://localhost:1234/')).toEqual({
name: 'http://localhost:1234/',
url: 'http://localhost:1234/',
Expand All @@ -48,7 +48,7 @@ describe('configuration', function () {
} as AASEndpoint);
});

it('gets an endpoint of an WebDAV server', function () {
it('gets an endpoint of an WebDAV server', () => {
expect(urlToEndpoint('http://localhost:1234/endpoints/samples')).toEqual({
name: 'samples',
url: 'http://localhost:1234/endpoints/samples',
Expand All @@ -57,7 +57,7 @@ describe('configuration', function () {
} as AASEndpoint);
});

it('gets an endpoint of an OPCUA server', function () {
it('gets an endpoint of an OPCUA server', () => {
expect(urlToEndpoint(new URL('opc.tcp://172.16.160.178:30001/I4AASServer?version=v1'))).toEqual({
name: 'I4AASServer',
url: 'opc.tcp://172.16.160.178:30001/I4AASServer',
Expand All @@ -66,7 +66,7 @@ describe('configuration', function () {
} as AASEndpoint);
});

it('gets an endpoint of an local directory', function () {
it('gets an endpoint of an local directory', () => {
expect(urlToEndpoint('file:///endpoints/samples')).toEqual({
name: 'samples',
url: 'file:///endpoints/samples',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ import { RegisterRoutes } from '../../app/routes/routes.js';
import { Authentication } from '../../app/controller/authentication.js';
import { errorHandler } from '../assets/error-handler.js';

describe('ContainersController', function () {
describe('ContainersController', () => {
let app: Express;
let logger: Logger;
let auth: jest.Mocked<AuthService>;
let aasProvider: jest.Mocked<AASProvider>;
let variable: jest.Mocked<Variable>;
let authentication: jest.Mocked<Authentication>;

beforeEach(function () {
beforeEach(() => {
logger = createSpyObj<Logger>(['error', 'warning', 'info', 'debug', 'start', 'stop']);
variable = createSpyObj<Variable>({}, { JWT_SECRET: 'SecretSecretSecretSecretSecretSecret' });
auth = createSpyObj<AuthService>([
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('ContainersController', function () {
app.use(errorHandler);
});

it('getPackage: /api/v1/containers/:endpoint/packages/:id', async function () {
it('getPackage: /api/v1/containers/:endpoint/packages/:id', async () => {
aasProvider.getPackageAsync.mockReturnValue(
new Promise<NodeJS.ReadableStream>(resolve => {
const s = new Readable();
Expand All @@ -97,7 +97,7 @@ describe('ContainersController', function () {
expect(aasProvider.getPackageAsync).toHaveBeenCalled();
});

it('addPackage: /api/v1/containers/:endpoint/packages', async function () {
it('addPackage: /api/v1/containers/:endpoint/packages', async () => {
auth.hasUserAsync.mockReturnValue(new Promise<boolean>(resolve => resolve(true)));
const response = await request(app)
.post('/api/v1/containers/U2FtcGxl/packages')
Expand All @@ -108,7 +108,7 @@ describe('ContainersController', function () {
expect(aasProvider.addPackagesAsync).toHaveBeenCalled();
});

it('deletePackage: /api/v1/containers/:endpoint/packages/:id', async function () {
it('deletePackage: /api/v1/containers/:endpoint/packages/:id', async () => {
auth.hasUserAsync.mockReturnValue(new Promise<boolean>(resolve => resolve(true)));
const response = await request(app)
.delete('/api/v1/containers/U2FtcGxl/packages/aHR0cDovL2N1c3RvbWVyLmNvbS9hYXMvOTE3NV83MDEzXzcwOTFfOTE2OA')
Expand All @@ -118,7 +118,7 @@ describe('ContainersController', function () {
expect(aasProvider.deletePackageAsync).toHaveBeenCalled();
});

it('getDocument: /api/v1/containers/:endpoint/documents/:id', async function () {
it('getDocument: /api/v1/containers/:endpoint/documents/:id', async () => {
aasProvider.getDocumentAsync.mockResolvedValue(sampleDocument);
const response = await request(app)
.get('/api/v1/containers/U2FtcGxl/documents/aHR0cDovL2N1c3RvbWVyLmNvbS9hYXMvOTE3NV83MDEzXzcwOTFfOTE2OA')
Expand All @@ -129,7 +129,7 @@ describe('ContainersController', function () {
expect(aasProvider.getDocumentAsync).toHaveBeenCalled();
});

it('getDocumentContent: /api/v1/containers/:url/documents/:id/content', async function () {
it('getDocumentContent: /api/v1/containers/:url/documents/:id/content', async () => {
aasProvider.getContentAsync.mockReturnValue(
new Promise<aas.Environment>(resolve => {
resolve({ assetAdministrationShells: [], submodels: [], conceptDescriptions: [] });
Expand All @@ -144,8 +144,8 @@ describe('ContainersController', function () {
expect(aasProvider.getContentAsync).toHaveBeenCalled();
});

describe('getDataElementValue: /api/v1/containers/:url/documents/:id/submodels/:smId/submodel-elements/:path/value', function () {
it('gets the value of a File that represents an image', async function () {
describe('getDataElementValue: /api/v1/containers/:url/documents/:id/submodels/:smId/submodel-elements/:path/value', () => {
it('gets the value of a File that represents an image', async () => {
aasProvider.getDataElementValueAsync.mockReturnValue(
new Promise<NodeJS.ReadableStream>(resolve => {
const s = new Readable();
Expand All @@ -165,7 +165,7 @@ describe('ContainersController', function () {
expect(aasProvider.getDataElementValueAsync).toHaveBeenCalled();
});

it('gets the value of a File', async function () {
it('gets the value of a File', async () => {
aasProvider.getDataElementValueAsync.mockReturnValue(
new Promise<NodeJS.ReadableStream>(resolve => {
const s = new Readable();
Expand All @@ -186,7 +186,7 @@ describe('ContainersController', function () {
expect(aasProvider.getDataElementValueAsync).toHaveBeenCalled();
});

it('gets the value of a Blob', async function () {
it('gets the value of a Blob', async () => {
aasProvider.getDataElementValueAsync.mockReturnValue(
new Promise<NodeJS.ReadableStream>(resolve => {
const s = new Readable();
Expand All @@ -208,7 +208,7 @@ describe('ContainersController', function () {
});
});

it('updateDocument: /api/v1/containers/:url/documents/:id', async function () {
it('updateDocument: /api/v1/containers/:url/documents/:id', async () => {
aasProvider.updateDocumentAsync.mockReturnValue(Promise.resolve([]));
auth.hasUserAsync.mockReturnValue(new Promise<boolean>(resolve => resolve(true)));

Expand All @@ -224,7 +224,7 @@ describe('ContainersController', function () {
expect(aasProvider.updateDocumentAsync).toHaveBeenCalled();
});

it('invokeOperation: /api/v1/containers/:url/documents/:id/invoke', async function () {
it('invokeOperation: /api/v1/containers/:url/documents/:id/invoke', async () => {
const operation: aas.Operation = {
idShort: 'noop',
modelType: 'Operation',
Expand Down

0 comments on commit de9f147

Please sign in to comment.