diff --git a/.eslintrc.json b/.eslintrc.json index d74c3872d..0ecf858c5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,9 +19,14 @@ "project": "./tsconfig.json" }, "plugins": [ - "@typescript-eslint" + "@typescript-eslint", + "license-header" ], "rules": { + "license-header/header": [ + "warn", + "./license-header.js" + ], "@typescript-eslint/strict-boolean-expressions": 0, "@typescript-eslint/restrict-template-expressions": 0, "@typescript-eslint/no-dynamic-delete": 0, diff --git a/.github/workflows/api-test.yml b/.github/workflows/api-test.yml index 7f6a89771..1e2c6883b 100644 --- a/.github/workflows/api-test.yml +++ b/.github/workflows/api-test.yml @@ -16,6 +16,7 @@ jobs: - run: docker-compose up -d - run: sleep 30 - run: docker run --network=host -v /home/runner/work/mps/mps/src/test/collections/:/collections postman/newman run /collections/MPS.postman_collection.json -e /collections/MPS.postman_environment.json --insecure + - run: docker run --network=host -v /home/runner/work/mps/mps/src/test/collections/:/collections postman/newman run /collections/mps_security_api_test_postman_collection.json -e /collections/MPS.postman_environment.json -d /collections/data/mps_security_api_test_data.json --insecure - name: Dump docker logs on if: failure() uses: jwalton/gh-docker-logs@v1 diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 1d615de01..e1ca1af44 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - node-version: [12.x, 14.x, 16.x, 17.x] + node-version: [14.x, 16.x, 18.x] steps: - uses: actions/checkout@v2 diff --git a/license-header.js b/license-header.js new file mode 100644 index 000000000..d5f986bf3 --- /dev/null +++ b/license-header.js @@ -0,0 +1,4 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a30f8b884..0b4b4ffab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "pg": "^8.7.3", "rc": "^1.2.8", "winston": "^3.7.2", - "ws": "^8.7.0", + "ws": "^8.8.0", "xml2js": "^0.4.23" }, "devDependencies": { @@ -39,14 +39,16 @@ "eslint": "^7.32.0", "eslint-config-standard": "^16.0.3", "eslint-config-standard-with-typescript": "^21.0.1", + "eslint-plugin-header": "^3.1.1", "eslint-plugin-import": "^2.26.0", + "eslint-plugin-license-header": "^0.4.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.0.0", "jest": "27.5.1", "jest-junit": "^13.2.0", "jest-transform-stub": "^2.0.0", "ts-jest": "^27.1.4", - "ts-node": "^10.8.0", + "ts-node": "^10.8.1", "typescript": "^4.7.3" }, "engines": { @@ -3399,6 +3401,15 @@ "eslint": ">=4.19.1" } }, + "node_modules/eslint-plugin-header": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz", + "integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==", + "dev": true, + "peerDependencies": { + "eslint": ">=7.7.0" + } + }, "node_modules/eslint-plugin-import": { "version": "2.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", @@ -3438,6 +3449,15 @@ "node": ">=0.10.0" } }, + "node_modules/eslint-plugin-license-header": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-license-header/-/eslint-plugin-license-header-0.4.0.tgz", + "integrity": "sha512-KNpyxD+r8d9VoioyaHofUDsrYO+epVv/WjGZKugfO+qVN1KvHi/LwpXXY1618OCOYEaRNXZeRUtbOIb2YvJXTw==", + "dev": true, + "dependencies": { + "requireindex": "^1.2.0" + } + }, "node_modules/eslint-plugin-node": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", @@ -6916,6 +6936,15 @@ "node": ">=0.10.0" } }, + "node_modules/requireindex": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz", + "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==", + "dev": true, + "engines": { + "node": ">=0.10.5" + } + }, "node_modules/resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -7648,9 +7677,9 @@ } }, "node_modules/ts-node": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.0.tgz", - "integrity": "sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==", + "version": "10.8.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.1.tgz", + "integrity": "sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", @@ -8097,9 +8126,9 @@ } }, "node_modules/ws": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz", - "integrity": "sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz", + "integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==", "engines": { "node": ">=10.0.0" }, @@ -10825,6 +10854,13 @@ "regexpp": "^3.0.0" } }, + "eslint-plugin-header": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz", + "integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==", + "dev": true, + "requires": {} + }, "eslint-plugin-import": { "version": "2.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", @@ -10857,6 +10893,15 @@ } } }, + "eslint-plugin-license-header": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-license-header/-/eslint-plugin-license-header-0.4.0.tgz", + "integrity": "sha512-KNpyxD+r8d9VoioyaHofUDsrYO+epVv/WjGZKugfO+qVN1KvHi/LwpXXY1618OCOYEaRNXZeRUtbOIb2YvJXTw==", + "dev": true, + "requires": { + "requireindex": "^1.2.0" + } + }, "eslint-plugin-node": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", @@ -13397,6 +13442,12 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, + "requireindex": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz", + "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==", + "dev": true + }, "resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -13937,9 +13988,9 @@ } }, "ts-node": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.0.tgz", - "integrity": "sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==", + "version": "10.8.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.1.tgz", + "integrity": "sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g==", "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", @@ -14274,9 +14325,9 @@ } }, "ws": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz", - "integrity": "sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz", + "integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==", "requires": {} }, "xml": { diff --git a/package.json b/package.json index b2f50ffc9..1e6f27f9c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "pg": "^8.7.3", "rc": "^1.2.8", "winston": "^3.7.2", - "ws": "^8.7.0", + "ws": "^8.8.0", "xml2js": "^0.4.23" }, "devDependencies": { @@ -63,14 +63,16 @@ "eslint": "^7.32.0", "eslint-config-standard": "^16.0.3", "eslint-config-standard-with-typescript": "^21.0.1", + "eslint-plugin-header": "^3.1.1", "eslint-plugin-import": "^2.26.0", + "eslint-plugin-license-header": "^0.4.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.0.0", "jest": "27.5.1", "jest-junit": "^13.2.0", "jest-transform-stub": "^2.0.0", "ts-jest": "^27.1.4", - "ts-node": "^10.8.0", + "ts-node": "^10.8.1", "typescript": "^4.7.3" } } diff --git a/src/Healthcheck.ts b/src/Healthcheck.ts index b417f4db7..bd83742e4 100644 --- a/src/Healthcheck.ts +++ b/src/Healthcheck.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { request } from 'http' import { RequestOptions } from 'https' diff --git a/src/amt/APFProcessor.test.ts b/src/amt/APFProcessor.test.ts index 48f23bf2e..211f660c3 100644 --- a/src/amt/APFProcessor.test.ts +++ b/src/amt/APFProcessor.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import Common from '../utils/common' import { logger } from '../logging' import APFProcessor, { APFProtocol } from './APFProcessor' diff --git a/src/amt/APFProcessor.ts b/src/amt/APFProcessor.ts index 5ec59b87e..1e7410722 100644 --- a/src/amt/APFProcessor.ts +++ b/src/amt/APFProcessor.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2018-2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/amt/CIRAChannel.test.ts b/src/amt/CIRAChannel.test.ts index 1069e3298..945a3fe53 100644 --- a/src/amt/CIRAChannel.test.ts +++ b/src/amt/CIRAChannel.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { CIRASocket } from '../models/models' import APFProcessor from './APFProcessor' import { CIRAChannel } from './CIRAChannel' diff --git a/src/amt/CIRAChannel.ts b/src/amt/CIRAChannel.ts index 99da48edc..aeabe4452 100644 --- a/src/amt/CIRAChannel.ts +++ b/src/amt/CIRAChannel.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2018-2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/amt/CIRAHandler.test.ts b/src/amt/CIRAHandler.test.ts index cfffbc3fb..1a2e2e2a6 100644 --- a/src/amt/CIRAHandler.test.ts +++ b/src/amt/CIRAHandler.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + // import { CIRASocket } from '../models/models' // import { card, computerSystemPackage, enumerateResponseCIMSoftwareIdentity } from '../test/helper/wsmanResponses' import { HttpZResponseModel } from 'http-z' diff --git a/src/amt/CIRAHandler.ts b/src/amt/CIRAHandler.ts index 95873ff44..eada64d10 100644 --- a/src/amt/CIRAHandler.ts +++ b/src/amt/CIRAHandler.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2018-2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/amt/ConnectedDevice.ts b/src/amt/ConnectedDevice.ts index 9b74cd735..7680560b7 100644 --- a/src/amt/ConnectedDevice.ts +++ b/src/amt/ConnectedDevice.ts @@ -1,7 +1,8 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2022 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { CIRASocket } from '../models/models' import { HttpHandler } from './HttpHandler' diff --git a/src/amt/DeviceAction.ts b/src/amt/DeviceAction.ts index c6d52e4c0..794fcee14 100644 --- a/src/amt/DeviceAction.ts +++ b/src/amt/DeviceAction.ts @@ -1,7 +1,8 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2022 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { logger, messages } from '../logging' import { CIRAHandler } from './CIRAHandler' import { AMT, CIM, IPS, Common } from '@open-amt-cloud-toolkit/wsman-messages' diff --git a/src/amt/HttpHandler.ts b/src/amt/HttpHandler.ts index e31fe7e7c..92d793e01 100644 --- a/src/amt/HttpHandler.ts +++ b/src/amt/HttpHandler.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2021 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { logger, messages } from '../logging' import { createHash } from 'crypto' diff --git a/src/amt/connectedDevice.test.ts b/src/amt/connectedDevice.test.ts index 81ac28528..aba847943 100644 --- a/src/amt/connectedDevice.test.ts +++ b/src/amt/connectedDevice.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { CIRASocket } from '../models/models' import { ConnectedDevice } from './ConnectedDevice' diff --git a/src/amt/deviceAction.test.ts b/src/amt/deviceAction.test.ts index 583638bb1..d89a1374a 100644 --- a/src/amt/deviceAction.test.ts +++ b/src/amt/deviceAction.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { CIRASocket } from '../models/models' import { amtMessageLog, diff --git a/src/amt/httpHandler.test.ts b/src/amt/httpHandler.test.ts index 56c337aa0..be58127c1 100644 --- a/src/amt/httpHandler.test.ts +++ b/src/amt/httpHandler.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { CIM, Common } from '@open-amt-cloud-toolkit/wsman-messages' import { connectionParams, HttpHandler } from './HttpHandler' diff --git a/src/custom.d.ts b/src/custom.d.ts index e0ead620a..b8ea0f323 100644 --- a/src/custom.d.ts +++ b/src/custom.d.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { DeviceAction } from './amt/DeviceAction' import { IDB } from './interfaces/IDb' import { ISecretManagerService } from './interfaces/ISecretManagerService' diff --git a/src/data/postgres/index.ts b/src/data/postgres/index.ts index ff2a5d2c6..bd7b03a82 100644 --- a/src/data/postgres/index.ts +++ b/src/data/postgres/index.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + /* Code pattern used to make connections and queries. Pattern referred from https://node-postgres.com/guides/project-structure diff --git a/src/data/postgres/postgresDb.test.ts b/src/data/postgres/postgresDb.test.ts index 8ed601399..41e7bce9f 100644 --- a/src/data/postgres/postgresDb.test.ts +++ b/src/data/postgres/postgresDb.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { QueryResult } from 'pg' import PostgresDb, { POSTGRES_RESPONSE_CODES } from '.' diff --git a/src/data/postgres/tables/device.test.ts b/src/data/postgres/tables/device.test.ts index fd139f171..05c4aa648 100644 --- a/src/data/postgres/tables/device.test.ts +++ b/src/data/postgres/tables/device.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { DeviceTable } from './device' import { Device } from '../../../models/models' import PostgresDb from '..' diff --git a/src/data/postgres/tables/device.ts b/src/data/postgres/tables/device.ts index e610932ec..f59890448 100644 --- a/src/data/postgres/tables/device.ts +++ b/src/data/postgres/tables/device.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { logger, messages } from '../../../logging' import { PostgresDb } from '..' import { IDeviceTable } from '../../../interfaces/IDeviceTable' diff --git a/src/factories/DbCreatorFactory.test.ts b/src/factories/DbCreatorFactory.test.ts index 1f5e54ecc..0d5c1515d 100644 --- a/src/factories/DbCreatorFactory.test.ts +++ b/src/factories/DbCreatorFactory.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import PostgresDb from '../data/postgres' import { Environment } from '../utils/Environment' import { DbCreatorFactory } from './DbCreatorFactory' diff --git a/src/factories/DbCreatorFactory.ts b/src/factories/DbCreatorFactory.ts index 814895def..26c469509 100644 --- a/src/factories/DbCreatorFactory.ts +++ b/src/factories/DbCreatorFactory.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/index.test.ts b/src/index.test.ts index d150ac660..1690e9b76 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import * as indexFile from './index' import { logger } from './logging' import { Environment } from './utils/Environment' diff --git a/src/index.ts b/src/index.ts index 4d9d52356..82179daf4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { logger } from './logging' import { configType, certificatesType } from './models/Config' diff --git a/src/interfaces/IDb.ts b/src/interfaces/IDb.ts index 36e503b29..c85ca8902 100644 --- a/src/interfaces/IDb.ts +++ b/src/interfaces/IDb.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/interfaces/IDeviceTable.ts b/src/interfaces/IDeviceTable.ts index e409aa33f..72fb4fa5e 100644 --- a/src/interfaces/IDeviceTable.ts +++ b/src/interfaces/IDeviceTable.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { Device } from '../models/models' import { ITable } from './ITable' diff --git a/src/interfaces/ILogger.ts b/src/interfaces/ILogger.ts index f82f150c0..fdb9ddc11 100644 --- a/src/interfaces/ILogger.ts +++ b/src/interfaces/ILogger.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2021 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ export interface ILogger { debug: (log: string, ...params: any[]) => void diff --git a/src/interfaces/ISecretManagerService.ts b/src/interfaces/ISecretManagerService.ts index 1b2740172..07718ae61 100644 --- a/src/interfaces/ISecretManagerService.ts +++ b/src/interfaces/ISecretManagerService.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2019 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/interfaces/ITable.ts b/src/interfaces/ITable.ts index d9f8dcb83..b617bdeac 100644 --- a/src/interfaces/ITable.ts +++ b/src/interfaces/ITable.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + export interface ITable { getCount: (tenantId?: string) => Promise get: (limit: number, offset: number, tenantId?: string) => Promise diff --git a/src/logging/index.ts b/src/logging/index.ts index dc90081bf..33778cafa 100644 --- a/src/logging/index.ts +++ b/src/logging/index.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2022 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ export { logger } from './logger' export { messages } from './messages' diff --git a/src/logging/logger.ts b/src/logging/logger.ts index c0a1e4cd9..932348bd4 100644 --- a/src/logging/logger.ts +++ b/src/logging/logger.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import * as winston from 'winston' import { ILogger } from '../interfaces/ILogger' diff --git a/src/logging/messages.ts b/src/logging/messages.ts index 047c6bd71..355f25520 100644 --- a/src/logging/messages.ts +++ b/src/logging/messages.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2022 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ export enum messages { AMT_FEATURES_EXCEPTION = 'Exception during AMT Features request', diff --git a/src/middleware/cira.ts b/src/middleware/cira.ts index 5a910e687..7eae987d4 100644 --- a/src/middleware/cira.ts +++ b/src/middleware/cira.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2021 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Request, Response } from 'express' import { CIRAHandler } from '../amt/CIRAHandler' diff --git a/src/middleware/validate.ts b/src/middleware/validate.ts index 76cbfc351..347fd3d89 100644 --- a/src/middleware/validate.ts +++ b/src/middleware/validate.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2021 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Request, Response } from 'express' import { validationResult } from 'express-validator' diff --git a/src/models/Config.d.ts b/src/models/Config.d.ts index f87405daa..900ebe2d1 100644 --- a/src/models/Config.d.ts +++ b/src/models/Config.d.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: config type definitions -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ export interface configType { common_name: string diff --git a/src/models/models.ts b/src/models/models.ts index 5fcbbecf6..393dca37b 100644 --- a/src/models/models.ts +++ b/src/models/models.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/amt/amtFeatureValidator.ts b/src/routes/amt/amtFeatureValidator.ts index 548381f71..179c355cf 100644 --- a/src/routes/amt/amtFeatureValidator.ts +++ b/src/routes/amt/amtFeatureValidator.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/amt/auditLog.test.ts b/src/routes/amt/auditLog.test.ts index d6a754e69..e8902009c 100644 --- a/src/routes/amt/auditLog.test.ts +++ b/src/routes/amt/auditLog.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { atob } from 'atob' import auditLog = require('./auditLog') import { MqttProvider } from '../../utils/MqttProvider' diff --git a/src/routes/amt/auditLog.ts b/src/routes/amt/auditLog.ts index ae8a48033..2ee2d909e 100644 --- a/src/routes/amt/auditLog.ts +++ b/src/routes/amt/auditLog.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: Handler to get amt device audit logs -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Response, Request } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/amt/auditLogValidator.ts b/src/routes/amt/auditLogValidator.ts index b2abf80f7..5ec6cf4ed 100644 --- a/src/routes/amt/auditLogValidator.ts +++ b/src/routes/amt/auditLogValidator.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/amt/bootOptions.test.ts b/src/routes/amt/bootOptions.test.ts index 8fc42a566..84707444d 100644 --- a/src/routes/amt/bootOptions.test.ts +++ b/src/routes/amt/bootOptions.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { AMT } from '@open-amt-cloud-toolkit/wsman-messages' import { CIRAHandler } from '../../amt/CIRAHandler' import { DeviceAction } from '../../amt/DeviceAction' diff --git a/src/routes/amt/bootOptions.ts b/src/routes/amt/bootOptions.ts index 618bb454f..73aed7163 100644 --- a/src/routes/amt/bootOptions.ts +++ b/src/routes/amt/bootOptions.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: Handler to execute a power action on amt device -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Response, Request } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/amt/bootOptionsValidator.ts b/src/routes/amt/bootOptionsValidator.ts index 239f7fb4a..7c8ee9833 100644 --- a/src/routes/amt/bootOptionsValidator.ts +++ b/src/routes/amt/bootOptionsValidator.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/amt/eventLog.test.ts b/src/routes/amt/eventLog.test.ts index 9ac52948b..7576dd6af 100644 --- a/src/routes/amt/eventLog.test.ts +++ b/src/routes/amt/eventLog.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { eventLog, GetEventDetailStr } from './eventLog' import { createSpyObj } from '../../test/helper/jest' import { amtMessageLog } from '../../test/helper/wsmanResponses' diff --git a/src/routes/amt/eventLog.ts b/src/routes/amt/eventLog.ts index 571027053..6a7eaea47 100644 --- a/src/routes/amt/eventLog.ts +++ b/src/routes/amt/eventLog.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: Handler to get amt device event logs -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Response, Request } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/amt/getAMTFeatures.test.ts b/src/routes/amt/getAMTFeatures.test.ts index bf65b2fd4..ab6b7c083 100644 --- a/src/routes/amt/getAMTFeatures.test.ts +++ b/src/routes/amt/getAMTFeatures.test.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { CIRAHandler } from '../../amt/CIRAHandler' import { DeviceAction } from '../../amt/DeviceAction' import { HttpHandler } from '../../amt/HttpHandler' diff --git a/src/routes/amt/getAMTFeatures.ts b/src/routes/amt/getAMTFeatures.ts index c04a25719..daf2d075e 100644 --- a/src/routes/amt/getAMTFeatures.ts +++ b/src/routes/amt/getAMTFeatures.ts @@ -1,8 +1,6 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2020 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 - * Description: Handler to get AMT Features - * Author: Madhavi Losetty **********************************************************************/ import { Response, Request } from 'express' diff --git a/src/routes/amt/getGeneralSettings.test.ts b/src/routes/amt/getGeneralSettings.test.ts index f08ec7b5f..8a151fa76 100644 --- a/src/routes/amt/getGeneralSettings.test.ts +++ b/src/routes/amt/getGeneralSettings.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { generalSettings } from './getGeneralSettings' import { createSpyObj } from '../../test/helper/jest' import { CIRAHandler } from '../../amt/CIRAHandler' diff --git a/src/routes/amt/getGeneralSettings.ts b/src/routes/amt/getGeneralSettings.ts index 4432b0ac2..d194f1cfa 100644 --- a/src/routes/amt/getGeneralSettings.ts +++ b/src/routes/amt/getGeneralSettings.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: Handler to get amt device general settings -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Response, Request } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/amt/getHardwareInfo.test.ts b/src/routes/amt/getHardwareInfo.test.ts index 3572ce188..7e1314440 100644 --- a/src/routes/amt/getHardwareInfo.test.ts +++ b/src/routes/amt/getHardwareInfo.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import * as hw from './getHardwareInfo' import { createSpyObj } from '../../test/helper/jest' import { biosElement, card, chassis, chip, computerSystemPackage, mediaAccessDevice, physicalMemory, physicalPackage, processor, systemPackaging } from '../../test/helper/wsmanResponses' diff --git a/src/routes/amt/getHardwareInfo.ts b/src/routes/amt/getHardwareInfo.ts index 98ae46b23..f53b6f434 100644 --- a/src/routes/amt/getHardwareInfo.ts +++ b/src/routes/amt/getHardwareInfo.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: Handler to get amt device audit logs -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Response, Request } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/amt/getPowerState.test.ts b/src/routes/amt/getPowerState.test.ts index a8e7d20c9..4f6ebb963 100644 --- a/src/routes/amt/getPowerState.test.ts +++ b/src/routes/amt/getPowerState.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { powerState } from './getPowerState' import { createSpyObj } from '../../test/helper/jest' import { serviceAvailableToElement } from '../../test/helper/wsmanResponses' diff --git a/src/routes/amt/getPowerState.ts b/src/routes/amt/getPowerState.ts index bfaf319ce..0a0b1e117 100644 --- a/src/routes/amt/getPowerState.ts +++ b/src/routes/amt/getPowerState.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: Handler to get amt device current power state -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Response, Request } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/amt/getVersion.test.ts b/src/routes/amt/getVersion.test.ts index 25058354a..c86c44086 100644 --- a/src/routes/amt/getVersion.test.ts +++ b/src/routes/amt/getVersion.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { version } from './getVersion' import { createSpyObj } from '../../test/helper/jest' import { setupAndConfigurationServiceResponse, softwareIdentityResponse, versionResponse } from '../../test/helper/wsmanResponses' diff --git a/src/routes/amt/getVersion.ts b/src/routes/amt/getVersion.ts index f47b956c0..456f83f4c 100644 --- a/src/routes/amt/getVersion.ts +++ b/src/routes/amt/getVersion.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: Handler to get amt device version -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Response, Request } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/amt/index.ts b/src/routes/amt/index.ts index e3b28d6a9..3f73e8d4c 100644 --- a/src/routes/amt/index.ts +++ b/src/routes/amt/index.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/amt/powerAction.test.ts b/src/routes/amt/powerAction.test.ts index 33ca3b29a..98ad38aa3 100644 --- a/src/routes/amt/powerAction.test.ts +++ b/src/routes/amt/powerAction.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { CIM } from '@open-amt-cloud-toolkit/wsman-messages' import { CIRAHandler } from '../../amt/CIRAHandler' import { DeviceAction } from '../../amt/DeviceAction' diff --git a/src/routes/amt/powerAction.ts b/src/routes/amt/powerAction.ts index 09515c276..3fe16363c 100644 --- a/src/routes/amt/powerAction.ts +++ b/src/routes/amt/powerAction.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: Handler to execute a power action on amt device -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Response, Request } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/amt/powerActionValidator.ts b/src/routes/amt/powerActionValidator.ts index 3e678595a..a52cbe85d 100644 --- a/src/routes/amt/powerActionValidator.ts +++ b/src/routes/amt/powerActionValidator.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/amt/powerCapabilities.test.ts b/src/routes/amt/powerCapabilities.test.ts index 227e0e53e..388e7cb65 100644 --- a/src/routes/amt/powerCapabilities.test.ts +++ b/src/routes/amt/powerCapabilities.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { ErrorResponse } from '../../utils/amtHelper' import { MqttProvider } from '../../utils/MqttProvider' import { powerCapabilities } from './powerCapabilities' diff --git a/src/routes/amt/powerCapabilities.ts b/src/routes/amt/powerCapabilities.ts index 909b48baf..d30e68a84 100644 --- a/src/routes/amt/powerCapabilities.ts +++ b/src/routes/amt/powerCapabilities.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: Handler to get power capabilities of amt device -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Response, Request } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/amt/setAMTFeatures.test.ts b/src/routes/amt/setAMTFeatures.test.ts index 7a4a4d8af..03fcbe6ef 100644 --- a/src/routes/amt/setAMTFeatures.test.ts +++ b/src/routes/amt/setAMTFeatures.test.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { MqttProvider } from '../../utils/MqttProvider' import { createSpyObj } from '../../test/helper/jest' import { setAMTFeatures } from './setAMTFeatures' diff --git a/src/routes/amt/setAMTFeatures.ts b/src/routes/amt/setAMTFeatures.ts index eecce42b4..f01367f16 100644 --- a/src/routes/amt/setAMTFeatures.ts +++ b/src/routes/amt/setAMTFeatures.ts @@ -1,9 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2020 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 - * Description: Handler to set AMT Features - * Author: Madhavi Losetty **********************************************************************/ + import { Response, Request } from 'express' import { logger, messages } from '../../logging' import { ErrorResponse } from '../../utils/amtHelper' diff --git a/src/routes/amt/userConsent/cancel.test.ts b/src/routes/amt/userConsent/cancel.test.ts index d066d0451..298ae2c51 100644 --- a/src/routes/amt/userConsent/cancel.test.ts +++ b/src/routes/amt/userConsent/cancel.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { createSpyObj } from '../../../test/helper/jest' import { cancel } from './cancel' import { cancelOptInResponse } from '../../../test/helper/wsmanResponses' diff --git a/src/routes/amt/userConsent/cancel.ts b/src/routes/amt/userConsent/cancel.ts index a3f82a131..62364da63 100644 --- a/src/routes/amt/userConsent/cancel.ts +++ b/src/routes/amt/userConsent/cancel.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { Response, Request } from 'express' import { logger, messages } from '../../../logging' import { ErrorResponse } from '../../../utils/amtHelper' diff --git a/src/routes/amt/userConsent/request.test.ts b/src/routes/amt/userConsent/request.test.ts index 49cc9f913..5d5fbca9b 100644 --- a/src/routes/amt/userConsent/request.test.ts +++ b/src/routes/amt/userConsent/request.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { createSpyObj } from '../../../test/helper/jest' import { request } from './request' import { startOptInResponse } from '../../../test/helper/wsmanResponses' diff --git a/src/routes/amt/userConsent/request.ts b/src/routes/amt/userConsent/request.ts index 6d9841c03..830673f35 100644 --- a/src/routes/amt/userConsent/request.ts +++ b/src/routes/amt/userConsent/request.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/amt/userConsent/send.test.ts b/src/routes/amt/userConsent/send.test.ts index 7bb8bf913..d799a105c 100644 --- a/src/routes/amt/userConsent/send.test.ts +++ b/src/routes/amt/userConsent/send.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { createSpyObj } from '../../../test/helper/jest' import { send } from './send' import { sendOptInCodeResponse } from '../../../test/helper/wsmanResponses' diff --git a/src/routes/amt/userConsent/send.ts b/src/routes/amt/userConsent/send.ts index 1f8e056f8..3a22c13e1 100644 --- a/src/routes/amt/userConsent/send.ts +++ b/src/routes/amt/userConsent/send.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { Response, Request } from 'express' import { logger, messages } from '../../../logging' import { ErrorResponse } from '../../../utils/amtHelper' diff --git a/src/routes/amt/userConsent/validator.ts b/src/routes/amt/userConsent/validator.ts index 890cfcd10..340b0ab11 100644 --- a/src/routes/amt/userConsent/validator.ts +++ b/src/routes/amt/userConsent/validator.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/auth/authValidator.test.ts b/src/routes/auth/authValidator.test.ts index 61e27f315..e073a7ffa 100644 --- a/src/routes/auth/authValidator.test.ts +++ b/src/routes/auth/authValidator.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import * as authValidator from './authValidator' describe('Check authValidator from auth', () => { diff --git a/src/routes/auth/authValidator.ts b/src/routes/auth/authValidator.ts index 33bc4decd..830f677ef 100644 --- a/src/routes/auth/authValidator.ts +++ b/src/routes/auth/authValidator.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/auth/authorizeDevice.test.ts b/src/routes/auth/authorizeDevice.test.ts index 653c68ef6..195121a52 100644 --- a/src/routes/auth/authorizeDevice.test.ts +++ b/src/routes/auth/authorizeDevice.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { authorizeDevice } from './authorizeDevice' import { createSpyObj } from '../../test/helper/jest' import { Environment } from '../../utils/Environment' diff --git a/src/routes/auth/authorizeDevice.ts b/src/routes/auth/authorizeDevice.ts index 396ba6821..d49afc183 100644 --- a/src/routes/auth/authorizeDevice.ts +++ b/src/routes/auth/authorizeDevice.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { Request, Response } from 'express' import { logger } from '../../logging/logger' import { Environment } from '../../utils/Environment' diff --git a/src/routes/auth/index.ts b/src/routes/auth/index.ts index aac1932c6..bc668cb3a 100644 --- a/src/routes/auth/index.ts +++ b/src/routes/auth/index.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/auth/login.test.ts b/src/routes/auth/login.test.ts index eb4c91a7f..7c73f2d16 100644 --- a/src/routes/auth/login.test.ts +++ b/src/routes/auth/login.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { login } from './login' import jws from 'jws' import { createSpyObj } from '../../test/helper/jest' diff --git a/src/routes/auth/login.ts b/src/routes/auth/login.ts index e464e872d..5ae8dd62b 100644 --- a/src/routes/auth/login.ts +++ b/src/routes/auth/login.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { validationResult } from 'express-validator' import { Request, Response } from 'express' import { logger } from '../../logging/logger' diff --git a/src/routes/auth/signature.ts b/src/routes/auth/signature.ts index 3c5ffd652..4bac1e787 100644 --- a/src/routes/auth/signature.ts +++ b/src/routes/auth/signature.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { Environment } from '../../utils/Environment' import jws from 'jws' diff --git a/src/routes/certs/index.test.ts b/src/routes/certs/index.test.ts index c723c23cc..545f5b29c 100644 --- a/src/routes/certs/index.test.ts +++ b/src/routes/certs/index.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { mpsrootcert } from './index' import { createSpyObj } from '../../test/helper/jest' import { ErrorResponse } from '../../utils/amtHelper' diff --git a/src/routes/certs/index.ts b/src/routes/certs/index.ts index aeccf0121..b76d95de6 100644 --- a/src/routes/certs/index.ts +++ b/src/routes/certs/index.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { logger, messages } from '../../logging' import { Request, Response } from 'express' import { ErrorResponse } from '../../utils/amtHelper' diff --git a/src/routes/devices/create.test.ts b/src/routes/devices/create.test.ts index 7b4681387..88ea95307 100644 --- a/src/routes/devices/create.test.ts +++ b/src/routes/devices/create.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { insertDevice } from './create' import { logger } from '../../logging' import { MPSValidationError } from '../../utils/MPSValidationError' diff --git a/src/routes/devices/create.ts b/src/routes/devices/create.ts index c27420b07..3dbeefc60 100644 --- a/src/routes/devices/create.ts +++ b/src/routes/devices/create.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { Device } from '../../models/models' import { logger, messages } from '../../logging' import { MPSValidationError } from '../../utils/MPSValidationError' diff --git a/src/routes/devices/delete.test.ts b/src/routes/devices/delete.test.ts index 395a10ca8..f4a28d361 100644 --- a/src/routes/devices/delete.test.ts +++ b/src/routes/devices/delete.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { logger } from '../../logging' import { deleteDevice } from './delete' diff --git a/src/routes/devices/delete.ts b/src/routes/devices/delete.ts index 590c74ecd..7a9279834 100644 --- a/src/routes/devices/delete.ts +++ b/src/routes/devices/delete.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { Request, Response } from 'express' import { logger, messages } from '../../logging' diff --git a/src/routes/devices/deviceValidator.ts b/src/routes/devices/deviceValidator.ts index b4b172e18..3a125b4fa 100644 --- a/src/routes/devices/deviceValidator.ts +++ b/src/routes/devices/deviceValidator.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/devices/disconnect.test.ts b/src/routes/devices/disconnect.test.ts index 53d5f7385..9120089b8 100644 --- a/src/routes/devices/disconnect.test.ts +++ b/src/routes/devices/disconnect.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { logger, messages } from '../../logging' import { devices } from '../../server/mpsserver' import { disconnect } from './disconnect' diff --git a/src/routes/devices/disconnect.ts b/src/routes/devices/disconnect.ts index 2d7e1b54b..81f434c01 100644 --- a/src/routes/devices/disconnect.ts +++ b/src/routes/devices/disconnect.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { ErrorResponse } from '../../utils/amtHelper' import { logger, messages } from '../../logging' import { Request, Response } from 'express' diff --git a/src/routes/devices/get.test.ts b/src/routes/devices/get.test.ts index d6e7e9ec8..cb04a8b7a 100644 --- a/src/routes/devices/get.test.ts +++ b/src/routes/devices/get.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { getDevice } from './get' import { logger } from '../../logging' diff --git a/src/routes/devices/get.ts b/src/routes/devices/get.ts index 319757dfd..4fa1a5ed7 100644 --- a/src/routes/devices/get.ts +++ b/src/routes/devices/get.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { logger, messages } from '../../logging' import { Request, Response } from 'express' diff --git a/src/routes/devices/getAll.test.ts b/src/routes/devices/getAll.test.ts index 22f9b60b9..518bf08c5 100644 --- a/src/routes/devices/getAll.test.ts +++ b/src/routes/devices/getAll.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { logger } from '../../logging' import { getAllDevices } from './getAll' diff --git a/src/routes/devices/getAll.ts b/src/routes/devices/getAll.ts index 8c7ccea0a..16c1ddb5f 100644 --- a/src/routes/devices/getAll.ts +++ b/src/routes/devices/getAll.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { Device } from '../../models/models' import { logger, messages } from '../../logging' import { DataWithCount } from '../../models/Config' diff --git a/src/routes/devices/index.test.ts b/src/routes/devices/index.test.ts index e0a84ec04..ca7199916 100644 --- a/src/routes/devices/index.test.ts +++ b/src/routes/devices/index.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import router from './index' describe('Check index from devices', () => { diff --git a/src/routes/devices/index.ts b/src/routes/devices/index.ts index 27d0b6a9d..b94305ea3 100644 --- a/src/routes/devices/index.ts +++ b/src/routes/devices/index.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/devices/stats.test.ts b/src/routes/devices/stats.test.ts index 8aa95ba5e..4a30a2245 100644 --- a/src/routes/devices/stats.test.ts +++ b/src/routes/devices/stats.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { stats } from './stats' let res: Express.Response diff --git a/src/routes/devices/stats.ts b/src/routes/devices/stats.ts index 2e5c5cbcf..5fb92a543 100644 --- a/src/routes/devices/stats.ts +++ b/src/routes/devices/stats.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/devices/tags.test.ts b/src/routes/devices/tags.test.ts index 1071d3dce..d84707cbe 100644 --- a/src/routes/devices/tags.test.ts +++ b/src/routes/devices/tags.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { getDistinctTags } from './tags' import { logger } from '../../logging' diff --git a/src/routes/devices/tags.ts b/src/routes/devices/tags.ts index acea197c5..af9227f08 100644 --- a/src/routes/devices/tags.ts +++ b/src/routes/devices/tags.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { logger, messages } from '../../logging' import { Request, Response } from 'express' diff --git a/src/routes/devices/update.test.ts b/src/routes/devices/update.test.ts index b61eaa043..e385e9fd7 100644 --- a/src/routes/devices/update.test.ts +++ b/src/routes/devices/update.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { MPSValidationError } from '../../utils/MPSValidationError' import { updateDevice } from './update' import { logger } from '../../logging' diff --git a/src/routes/devices/update.ts b/src/routes/devices/update.ts index 6726fd3fe..162d2c6f8 100644 --- a/src/routes/devices/update.ts +++ b/src/routes/devices/update.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { logger, messages } from '../../logging' import { MPSValidationError } from '../../utils/MPSValidationError' import { Request, Response } from 'express' diff --git a/src/routes/health/get.test.ts b/src/routes/health/get.test.ts index 0b8bfff15..6cb7c737c 100644 --- a/src/routes/health/get.test.ts +++ b/src/routes/health/get.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { getHealthCheck, getDBHealth, getSecretStoreHealth } from './get' import { Environment } from '../../utils/Environment' import { createSpyObj } from '../../test/helper/jest' diff --git a/src/routes/health/get.ts b/src/routes/health/get.ts index 20ca61ea8..735be0221 100644 --- a/src/routes/health/get.ts +++ b/src/routes/health/get.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/health/index.test.ts b/src/routes/health/index.test.ts index 0c897c05b..03b150912 100644 --- a/src/routes/health/index.test.ts +++ b/src/routes/health/index.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import index from './index' describe('Check index from health', () => { diff --git a/src/routes/health/index.ts b/src/routes/health/index.ts index d915b3d91..f11da5302 100644 --- a/src/routes/health/index.ts +++ b/src/routes/health/index.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2019 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/routes/index.test.ts b/src/routes/index.test.ts index ae3696f18..d5b30547d 100644 --- a/src/routes/index.test.ts +++ b/src/routes/index.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import router from './index' describe('Check index from routes', () => { diff --git a/src/routes/index.ts b/src/routes/index.ts index 88b9d6643..b82b3278f 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2021 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { Router } from 'express' import deviceRouter from './devices/index' diff --git a/src/server/mpsserver.ts b/src/server/mpsserver.ts index cfccba603..fa724857c 100644 --- a/src/server/mpsserver.ts +++ b/src/server/mpsserver.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2018-2019 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ /* Construct a Intel AMT MPS server object Note: diff --git a/src/server/mpsservertest.test.ts b/src/server/mpsservertest.test.ts index 75debbf60..93a9c222a 100644 --- a/src/server/mpsservertest.test.ts +++ b/src/server/mpsservertest.test.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { certificatesType } from '../models/Config' import { devices, MPSServer } from './mpsserver' diff --git a/src/server/webserver.test.ts b/src/server/webserver.test.ts index 374c19ee9..ac0f90fd4 100644 --- a/src/server/webserver.test.ts +++ b/src/server/webserver.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { certificatesType } from '../models/Config' import { ISecretManagerService } from '../interfaces/ISecretManagerService' import { config } from '../test/helper/config' diff --git a/src/server/webserver.ts b/src/server/webserver.ts index 1a182d31e..ae797eb40 100644 --- a/src/server/webserver.ts +++ b/src/server/webserver.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2018-2019 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ /** * @description Intel AMT Web server object diff --git a/src/test/collections/data/mps_security_api_test_data.json b/src/test/collections/data/mps_security_api_test_data.json new file mode 100644 index 000000000..90aeaf2dd --- /dev/null +++ b/src/test/collections/data/mps_security_api_test_data.json @@ -0,0 +1,58 @@ +[ + { + "_TEST_CASE_6597": "MPS: Rest API- Use POST method for mps api's (positive test)", + "url": "{{protocol}}://{{host}}/api/v1/authorize", + "verb": "POST", + "body": "{\"username\":\"standalone\",\"password\":\"G@ppm0ym\"}", + "expected": "200" + }, + { + "_TEST_CASE_6597": "MPS: Rest API- Use PUT method for mps api (negative test)", + "url": "{{protocol}}://{{host}}/api/v1/authorize", + "verb": "PUT", + "body": "{\"username\":\"standalone\",\"password\":\"G@ppm0ym\"}", + "expected": "404" + }, + { + "_TEST_CASE_5368": "MPS: Rest API- Use POST method for mps api (positive test)", + "url": "{{protocol}}://{{host}}/api/v1/authorize", + "verb": "POST", + "body": "{\"username\":\"standalone\",\"password\":\"G@ppm0ym\"}", + + "expected": "200" + }, + { + "_TEST_CASE_5368": "MPS: Rest API- Use GET method for mps api's instead of POST (negative test)", + "url": "{{protocol}}://{{host}}/api/v1/authorize", + "verb": "GET", + "body": "{\"username\":\"standalone\",\"password\":\"G@ppm0ym\"}", + "expected": "404" + }, + { + "_TEST_CASE_6599": "MPS: Rest API- Use POST method for mps api (positive test)", + "url": "{{protocol}}://{{host}}/api/v1/devices", + "verb": "POST", + "body": "{ \"guid\": \"123e4567-e89b-12d3-a456-426614174002\", \"hostname\": \"AMTDEVICENUC2\", \"tags\": [ \"Texas\", \"NUC\", \"Store #222\" ]}", + "expected": "201" + }, + { + "_TEST_CASE_6599": "MPS: Rest API- Use DELETE method for mps api's instead of POST (negative test)", + "url": "{{protocol}}://{{host}}/api/v1/devices", + "verb": "DELETE", + "body": "{ \"guid\": \"123e4567-e89b-12d3-a456-426614174002\", \"hostname\": \"AMTDEVICENUC2\", \"tags\": [ \"Texas\", \"NUC\", \"Store #222\" ]}", + "expected": "404" + }, + { + "_TEST_CASE_6601": "MPS: Rest API- Use POST method for mps api (positive test)", + "url": "{{protocol}}://{{host}}/api/v1/devices", + "verb": "POST", + "body": "{ \"guid\": \"123e4567-e89b-12d3-a456-426614174003\", \"hostname\": \"AMTDEVICENUC3\", \"tags\": [ \"Texas\", \"NUC\", \"Store #333\" ]}", + "expected": "201" + }, + { + "_TEST_CASE_6601": "MPS: Rest API- Use COPY method for mps api's instead of POST (negative test)", + "url": "{{protocol}}://{{host}}/api/v1/devices", + "verb": "COPY", + "expected": "404" + } +] \ No newline at end of file diff --git a/src/test/collections/mps_security_api_test_postman_collection.json b/src/test/collections/mps_security_api_test_postman_collection.json new file mode 100644 index 000000000..7bb3d6d90 --- /dev/null +++ b/src/test/collections/mps_security_api_test_postman_collection.json @@ -0,0 +1,70 @@ +{ + "info": { + "_postman_id": "d0edafd2-5cf9-4fab-83ce-306db5584098", + "name": "Verbs Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "postman-calls-using-verbs", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.globals.set(\"METHOD\", \"{{verb}}\");\r", + "\r", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response Status Code is: \" + pm.response.code, () => {\r", + " pm.expect(pm.response.code).to.equal(Number(data.expected));\r", + " if (pm.response.code === 200 && pm.request.url.getPath() === '/mps/login/api/v1/authorize' && pm.request.method === 'POST') {\r", + " pm.collectionVariables.set(\"token\", pm.response.json().token);\r", + " console.log(pm.collectionVariables.get(\"token\"))\r", + " }\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "method": "{{METHOD}}", + "header": [], + "body": { + "mode": "raw", + "raw": "{{body}}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}", + "host": [ + "{{url}}" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/src/test/helper/config.ts b/src/test/helper/config.ts index eff42d43e..cbd6aeec3 100644 --- a/src/test/helper/config.ts +++ b/src/test/helper/config.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { configType } from '../../models/Config' // Parsing configuration diff --git a/src/test/helper/jest.ts b/src/test/helper/jest.ts index 8ae0fe389..ec65bf5c2 100644 --- a/src/test/helper/jest.ts +++ b/src/test/helper/jest.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + export const createSpyObj = (baseName, methodNames): { [key: string]: jest.Mock } => { const obj: any = {} diff --git a/src/test/helper/wsmanResponses.ts b/src/test/helper/wsmanResponses.ts index 04cd6f1dd..bccf6ffb0 100644 --- a/src/test/helper/wsmanResponses.ts +++ b/src/test/helper/wsmanResponses.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + export const enumerateResponse = { Envelope: { Header: { diff --git a/src/utils/Environment.ts b/src/utils/Environment.ts index 1b3902066..1ef38aae7 100644 --- a/src/utils/Environment.ts +++ b/src/utils/Environment.ts @@ -1,7 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ + import { configType } from '../models/Config' const Environment = { diff --git a/src/utils/MPSValidationError.ts b/src/utils/MPSValidationError.ts index 0c871c52b..416396554 100644 --- a/src/utils/MPSValidationError.ts +++ b/src/utils/MPSValidationError.ts @@ -1,8 +1,8 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2020 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 - * Author: Madhavi Losetty **********************************************************************/ + export class MPSValidationError extends Error { constructor (public message: string, public status?: number, public errorName?: string) { super(message) diff --git a/src/utils/MqttProvider.ts b/src/utils/MqttProvider.ts index d810feb1f..b292e4c5e 100644 --- a/src/utils/MqttProvider.ts +++ b/src/utils/MqttProvider.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2021 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import url from 'url' import { eventType, OpenAMTEvent } from '../models/models' diff --git a/src/utils/SecretManagerService.ts b/src/utils/SecretManagerService.ts index cbf4cbb4d..f9c5fcdf5 100644 --- a/src/utils/SecretManagerService.ts +++ b/src/utils/SecretManagerService.ts @@ -1,8 +1,6 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2019 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 - * Description: stores amt profiles - * Author: Ramu Bachala **********************************************************************/ import { ISecretManagerService } from '../interfaces/ISecretManagerService' diff --git a/src/utils/amtHelper.ts b/src/utils/amtHelper.ts index 16ad4320b..88c54185b 100644 --- a/src/utils/amtHelper.ts +++ b/src/utils/amtHelper.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { httpErrorTable } from './constants' diff --git a/src/utils/certificates.test.ts b/src/utils/certificates.test.ts index ab4e2fb7f..170d8ecc1 100644 --- a/src/utils/certificates.test.ts +++ b/src/utils/certificates.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { Certificates } from './certificates' import { certificatesType } from '../models/Config' import forge from 'node-forge' diff --git a/src/utils/certificates.ts b/src/utils/certificates.ts index 2cfbff673..9fb0a02f8 100644 --- a/src/utils/certificates.ts +++ b/src/utils/certificates.ts @@ -1,7 +1,8 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + /** * @fileoverview Script Compiler / Decompiler / Runner * @author Ylian Saint-Hilaire diff --git a/src/utils/common.test.ts b/src/utils/common.test.ts index 62619d98f..90934bf49 100644 --- a/src/utils/common.test.ts +++ b/src/utils/common.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + // Import all required methods from common.js file import Common from './common' const v = 256 diff --git a/src/utils/common.ts b/src/utils/common.ts index add4bbf10..9ca539ea0 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -1,7 +1,8 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2021 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { createHash, randomBytes } from 'crypto' const Common = { ReadShort: (v: string, p: number): number => { diff --git a/src/utils/constants.ts b/src/utils/constants.ts index bec6e4ac7..ec387873e 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ export const amtPort = 16992 diff --git a/src/utils/mqttProvider.test.ts b/src/utils/mqttProvider.test.ts index 5a4ead48f..1a695a1b0 100644 --- a/src/utils/mqttProvider.test.ts +++ b/src/utils/mqttProvider.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { MqttProvider } from './MqttProvider' import { Environment } from './Environment' import { config } from '../test/helper/config' diff --git a/src/utils/parseEnvValue.test.ts b/src/utils/parseEnvValue.test.ts index 8b977ca4f..9f0734f78 100644 --- a/src/utils/parseEnvValue.test.ts +++ b/src/utils/parseEnvValue.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import * as parse from './parseEnvValue' describe('Check parseEnvValue', () => { diff --git a/src/utils/parseEnvValue.ts b/src/utils/parseEnvValue.ts index 2cb281ad6..929f10782 100644 --- a/src/utils/parseEnvValue.ts +++ b/src/utils/parseEnvValue.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2021 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ // Convert boolean strings to boolean // And number strings to numbers. diff --git a/src/utils/parseWSManResponseBody.test.ts b/src/utils/parseWSManResponseBody.test.ts index 5ab814c2b..f1d21f8c7 100644 --- a/src/utils/parseWSManResponseBody.test.ts +++ b/src/utils/parseWSManResponseBody.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { HttpZResponseModel } from 'http-z' import { parseBody } from './parseWSManResponseBody' diff --git a/src/utils/parseWSManResponseBody.ts b/src/utils/parseWSManResponseBody.ts index b703d5544..5d7e125da 100644 --- a/src/utils/parseWSManResponseBody.ts +++ b/src/utils/parseWSManResponseBody.ts @@ -1,7 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2021 -* SPDX-License-Identifier: Apache-2.0 -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import { HttpZResponseModel } from 'http-z' diff --git a/src/utils/redirectInterceptor.ts b/src/utils/redirectInterceptor.ts index 69231d2b2..e3fc48328 100644 --- a/src/utils/redirectInterceptor.ts +++ b/src/utils/redirectInterceptor.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/ diff --git a/src/utils/secretManagerService.test.ts b/src/utils/secretManagerService.test.ts index e074813a8..a84c3b36d 100644 --- a/src/utils/secretManagerService.test.ts +++ b/src/utils/secretManagerService.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { SecretManagerService } from './SecretManagerService' import { logger } from '../logging' import { config } from '../test/helper/config' diff --git a/src/utils/tlsConfiguration.test.ts b/src/utils/tlsConfiguration.test.ts index 63e779508..fab928cdc 100644 --- a/src/utils/tlsConfiguration.test.ts +++ b/src/utils/tlsConfiguration.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import tlsConfiguration from './tlsConfiguration' import path from 'path' import fs from 'fs' diff --git a/src/utils/tlsConfiguration.ts b/src/utils/tlsConfiguration.ts index 5262bf2f9..40eaa50d9 100644 --- a/src/utils/tlsConfiguration.ts +++ b/src/utils/tlsConfiguration.ts @@ -1,8 +1,7 @@ /********************************************************************* -* Copyright (c) Intel Corporation 2019 -* SPDX-License-Identifier: Apache-2.0 -* Description: MPS and Web Server TLS Configuration Interface -**********************************************************************/ + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ import path from 'path' import fs from 'fs' diff --git a/src/utils/wsRedirect.test.ts b/src/utils/wsRedirect.test.ts index 831094add..9cb24308e 100644 --- a/src/utils/wsRedirect.test.ts +++ b/src/utils/wsRedirect.test.ts @@ -1,3 +1,8 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + import { WsRedirect } from './wsRedirect' import { queryParams } from '../models/Config' import { RedirectInterceptor } from './redirectInterceptor' diff --git a/src/utils/wsRedirect.ts b/src/utils/wsRedirect.ts index b62a41633..c918e5f3b 100644 --- a/src/utils/wsRedirect.ts +++ b/src/utils/wsRedirect.ts @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) Intel Corporation 2021 + * Copyright (c) Intel Corporation 2022 * SPDX-License-Identifier: Apache-2.0 **********************************************************************/