From d6c4985aa8e35dd2278af9b70d00d4e86a48bde1 Mon Sep 17 00:00:00 2001 From: wanlingt Date: Thu, 16 Nov 2023 14:49:49 +0800 Subject: [PATCH 1/3] fix: add error handling --- .../encrypt-submission.middleware.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app/modules/submission/encrypt-submission/encrypt-submission.middleware.ts b/src/app/modules/submission/encrypt-submission/encrypt-submission.middleware.ts index c9e2de26c8..2de2d7e4e7 100644 --- a/src/app/modules/submission/encrypt-submission/encrypt-submission.middleware.ts +++ b/src/app/modules/submission/encrypt-submission/encrypt-submission.middleware.ts @@ -442,10 +442,8 @@ export const validateStorageSubmission = async ( meta: logMeta, error, }) - const { statusCode, errorMessage } = mapRouteError(error) - return res.status(statusCode).json({ - message: errorMessage, - }) + + return error } logger.warn({ message: @@ -511,8 +509,9 @@ export const validateStorageSubmission = async ( meta: logMeta, error, }) - return res.status(StatusCodes.INTERNAL_SERVER_ERROR).json({ - message: 'Error saving responses in req.body', + const { statusCode, errorMessage } = mapRouteError(error) + return res.status(statusCode).json({ + message: errorMessage, spcpSubmissionFailure, }) }) From 253dd2596844d28e5dc3caae298fc775fb1a3f75 Mon Sep 17 00:00:00 2001 From: wanlingt Date: Thu, 16 Nov 2023 14:50:11 +0800 Subject: [PATCH 2/3] chore: bump version to 6.89.1 --- CHANGELOG.md | 10 +++++++--- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1804b378fb..d66fc5f5c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -#### [v6.89.0](https://github.com/opengovsg/FormSG/compare/v6.89.0...v6.89.0) +#### [v6.89.1](https://github.com/opengovsg/FormSG/compare/v6.89.0...v6.89.1) -- fix: add learn more link [`#6897`](https://github.com/opengovsg/FormSG/pull/6897) +- build: release v6.89.0 [`#6898`](https://github.com/opengovsg/FormSG/pull/6898) +- fix: remove myinfo child from storage mode [`#6901`](https://github.com/opengovsg/FormSG/pull/6901) +- fix: add error handling [`d6c4985`](https://github.com/opengovsg/FormSG/commit/d6c4985aa8e35dd2278af9b70d00d4e86a48bde1) +- fix: remove email mode from myinfo limit message [`5a45c98`](https://github.com/opengovsg/FormSG/commit/5a45c980dbe3fc8c15eacb3ff1827f3003fcbfc4) #### [v6.89.0](https://github.com/opengovsg/FormSG/compare/v6.88.0...v6.89.0) > 15 November 2023 +- fix: add learn more link [`#6897`](https://github.com/opengovsg/FormSG/pull/6897) - chore: security upgrade axios to 1.6.2 [`#6893`](https://github.com/opengovsg/FormSG/pull/6893) - feat: myinfo for storage-mode [`#6870`](https://github.com/opengovsg/FormSG/pull/6870) - feat: announcement modal and what's new for myinfo storage-mode [`#6892`](https://github.com/opengovsg/FormSG/pull/6892) @@ -22,7 +26,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fix(deps): bump type-fest from 4.5.0 to 4.7.1 in /shared [`#6883`](https://github.com/opengovsg/FormSG/pull/6883) - build: merge release 6.88.0 into develop [`#6882`](https://github.com/opengovsg/FormSG/pull/6882) - build: release v6.88.0 [`#6881`](https://github.com/opengovsg/FormSG/pull/6881) -- chore: bump version to v6.89.0 [`e511d27`](https://github.com/opengovsg/FormSG/commit/e511d27cee4cf0ad5f5687046dfb25577125942d) +- chore: bump version to v6.89.0 [`1665a48`](https://github.com/opengovsg/FormSG/commit/1665a48b0ff133378c7126d3fedf8f1145f67111) #### [v6.88.0](https://github.com/opengovsg/FormSG/compare/v6.87.0...v6.88.0) diff --git a/package-lock.json b/package-lock.json index 9cca008f95..554a33c83e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "FormSG", - "version": "6.89.0", + "version": "6.89.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "FormSG", - "version": "6.89.0", + "version": "6.89.1", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudwatch-logs": "^3.347.1", diff --git a/package.json b/package.json index 9df9a1e8e7..342bd6a950 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "FormSG", "description": "Form Manager for Government", - "version": "6.89.0", + "version": "6.89.1", "homepage": "https://form.gov.sg", "authors": [ "FormSG " From fb415fcd7189a90056557c242ed98f1dc10e757e Mon Sep 17 00:00:00 2001 From: wanlingt Date: Thu, 16 Nov 2023 15:19:12 +0800 Subject: [PATCH 3/3] fix: remove error block --- .../encrypt-submission.middleware.ts | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/src/app/modules/submission/encrypt-submission/encrypt-submission.middleware.ts b/src/app/modules/submission/encrypt-submission/encrypt-submission.middleware.ts index 2de2d7e4e7..f6f07b88a8 100644 --- a/src/app/modules/submission/encrypt-submission/encrypt-submission.middleware.ts +++ b/src/app/modules/submission/encrypt-submission/encrypt-submission.middleware.ts @@ -430,30 +430,6 @@ export const validateStorageSubmission = async ( req.formsg.filteredResponses = responses return { parsedResponses, form: formDef } }) - .mapErr((error) => { - // TODO(FRM-1318): Set DB flag to true to harden submission validation after validation has similar error rates as email mode forms. - if ( - req.formsg.featureFlags.includes( - featureFlags.encryptionBoundaryShiftHardValidation, - ) - ) { - logger.error({ - message: 'Error processing responses', - meta: logMeta, - error, - }) - - return error - } - logger.warn({ - message: - 'Error processing responses, but proceeding with submission as submission have been validated client-side', - meta: logMeta, - error, - }) - req.formsg.filteredResponses = req.body.responses - return error - }) .andThen(({ parsedResponses, form }) => { // Validate MyInfo responses const { authType } = form