From 1ebbbd028f19e370416d89a24010ca8055c98a6d Mon Sep 17 00:00:00 2001 From: Santosh Shinde Date: Thu, 11 Jan 2024 21:47:36 +0530 Subject: [PATCH 1/3] update test cases --- coverage/lcov.info | 8 ++++---- test-report.xml | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/coverage/lcov.info b/coverage/lcov.info index fbb3d6df..1e49f727 100644 --- a/coverage/lcov.info +++ b/coverage/lcov.info @@ -222,14 +222,14 @@ DA:1,4 DA:3,4 DA:5,4 DA:7,4 -DA:8,1 +DA:8,0 DA:11,4 DA:19,4 LF:7 -LH:7 -BRDA:7,0,0,1 +LH:6 +BRDA:7,0,0,0 BRF:1 -BRH:1 +BRH:0 end_of_record TN: SF:src/middleware/error-handler.ts diff --git a/test-report.xml b/test-report.xml index 8ffe9dc8..2f383195 100644 --- a/test-report.xml +++ b/test-report.xml @@ -3,34 +3,34 @@ - - - - + - - - - - + + + + + + + + - + - + @@ -38,6 +38,6 @@ - + \ No newline at end of file From b0ca3d0be00646f5c7f21aad264944de12b39058 Mon Sep 17 00:00:00 2001 From: Santosh Shinde Date: Thu, 11 Jan 2024 22:00:37 +0530 Subject: [PATCH 2/3] fixed snyk - Information Exposure --- coverage/lcov.info | 30 ++++++++++----------- src/middleware/error-handler.ts | 6 ++--- test-report.xml | 46 ++++++++++++++++----------------- 3 files changed, 40 insertions(+), 42 deletions(-) diff --git a/coverage/lcov.info b/coverage/lcov.info index 1e49f727..df4d2326 100644 --- a/coverage/lcov.info +++ b/coverage/lcov.info @@ -222,14 +222,14 @@ DA:1,4 DA:3,4 DA:5,4 DA:7,4 -DA:8,0 +DA:8,1 DA:11,4 DA:19,4 LF:7 -LH:6 -BRDA:7,0,0,0 +LH:7 +BRDA:7,0,0,1 BRF:1 -BRH:0 +BRH:1 end_of_record TN: SF:src/middleware/error-handler.ts @@ -245,23 +245,23 @@ DA:8,3 DA:14,5 DA:15,5 DA:16,5 -DA:23,5 -DA:31,5 -DA:32,1 -DA:34,5 +DA:22,5 +DA:29,5 +DA:30,1 +DA:32,5 +DA:33,5 DA:35,5 -DA:37,5 -DA:40,3 +DA:38,3 LF:15 LH:15 BRDA:14,0,0,5 BRDA:15,1,0,5 BRDA:15,1,1,1 -BRDA:25,2,0,5 -BRDA:25,2,1,4 -BRDA:31,3,0,1 -BRDA:31,4,0,5 -BRDA:31,4,1,5 +BRDA:24,2,0,5 +BRDA:24,2,1,4 +BRDA:29,3,0,1 +BRDA:29,4,0,5 +BRDA:29,4,1,5 BRF:8 BRH:8 end_of_record diff --git a/src/middleware/error-handler.ts b/src/middleware/error-handler.ts index 2e02373c..723edf29 100644 --- a/src/middleware/error-handler.ts +++ b/src/middleware/error-handler.ts @@ -1,7 +1,7 @@ import * as util from 'util'; import * as express from 'express'; import { StatusCodes } from 'http-status-codes'; -import ApiError from '../abstractions/ApiError'; +import ApiError, { IError } from '../abstractions/ApiError'; import Crypto from '../lib/crypto'; import logger from '../lib/logger'; @@ -19,13 +19,11 @@ const addErrorHandler = ( \nREQUEST PARAMS:\n${util.inspect(req.params)} \nREQUEST QUERY:\n${util.inspect(req.query)} \nBODY:\n${util.inspect(req.body)}`); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let body: any = { + let body: IError | String = { fields: err.fields, message: err.message || 'An error occurred during the request.', name: err.name, status, - stack: '', }; if (process.env.APPLY_ENCRYPTION && process.env.SECRET_KEY) { diff --git a/test-report.xml b/test-report.xml index 2f383195..21a0420e 100644 --- a/test-report.xml +++ b/test-report.xml @@ -4,40 +4,40 @@ - - - + + + + + + - - - + + + - - - - - - - - - - - + + - - + + - - - - + + + + + + + + + + \ No newline at end of file From 132cd6aa22a917915e024e4b2b59e016d5b0043b Mon Sep 17 00:00:00 2001 From: Santosh Shinde Date: Thu, 11 Jan 2024 22:01:38 +0530 Subject: [PATCH 3/3] fixed snyk - Information Exposure --- src/middleware/error-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware/error-handler.ts b/src/middleware/error-handler.ts index 723edf29..83ed58dd 100644 --- a/src/middleware/error-handler.ts +++ b/src/middleware/error-handler.ts @@ -19,7 +19,7 @@ const addErrorHandler = ( \nREQUEST PARAMS:\n${util.inspect(req.params)} \nREQUEST QUERY:\n${util.inspect(req.query)} \nBODY:\n${util.inspect(req.body)}`); - let body: IError | String = { + let body: IError | string = { fields: err.fields, message: err.message || 'An error occurred during the request.', name: err.name,