diff --git a/CHANGELOG.md b/CHANGELOG.md index 81d3e1218d..e9c65fbc99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,35 @@ 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.115.1](https://github.com/opengovsg/FormSG/compare/v6.115.0...v6.115.1) + +- * chore(deps-dev): bump @types/express from 4.17.17 to 4.17.21 (#7233) [`#7241`](https://github.com/opengovsg/FormSG/pull/7241) +- fix: add check to block webhooks updates on mrf [`71ab0c5`](https://github.com/opengovsg/FormSG/commit/71ab0c592c15de5fddbffc9970a424af7a31d4ab) + +#### [v6.115.0](https://github.com/opengovsg/FormSG/compare/v6.114.1...v6.115.0) + +> 3 April 2024 + +- fix: correct date validation for disabled fields [`#7240`](https://github.com/opengovsg/FormSG/pull/7240) +- build: merge release v6.114.1 back to develop [`#7228`](https://github.com/opengovsg/FormSG/pull/7228) +- chore(mrf): add announcement content [`#7229`](https://github.com/opengovsg/FormSG/pull/7229) +- chore(mrf): remove flags [`#7230`](https://github.com/opengovsg/FormSG/pull/7230) +- fix(mrf): workflow email UI cleanup [`#7215`](https://github.com/opengovsg/FormSG/pull/7215) +- fix: add secret key input mask [`#7227`](https://github.com/opengovsg/FormSG/pull/7227) +- fix: correcting submission button bug for MRF [`#7232`](https://github.com/opengovsg/FormSG/pull/7232) +- fix(mrf): handling for incorrect submission secret key in url query params [`#7219`](https://github.com/opengovsg/FormSG/pull/7219) +- chore(deps-dev): bump @types/json-stringify-safe from 5.0.0 to 5.0.3 [`#7235`](https://github.com/opengovsg/FormSG/pull/7235) +- fix(deps): bump nan from 2.17.0 to 2.19.0 [`#7212`](https://github.com/opengovsg/FormSG/pull/7212) +- chore(deps-dev): bump @types/express from 4.17.17 to 4.17.21 [`#7233`](https://github.com/opengovsg/FormSG/pull/7233) +- chore: bump version to v6.115.0 [`8f02ef7`](https://github.com/opengovsg/FormSG/commit/8f02ef7e50f709ecb1b7ab55f1dfc867e41c6662) + #### [v6.114.1](https://github.com/opengovsg/FormSG/compare/v6.114.0...v6.114.1) +> 3 April 2024 + - build: release v6.114.0 [`#7226`](https://github.com/opengovsg/FormSG/pull/7226) -- fix: correcting submission button bug for MRF [`7342138`](https://github.com/opengovsg/FormSG/commit/73421387daf8f3a33c0030a43c81bb11190ee198) -- ref: genericize EndPageBlock [`017cfb3`](https://github.com/opengovsg/FormSG/commit/017cfb36457cbe293360c963f3d66257e5172907) +- chore: bump version to 6.114.1 [`c1c7ac2`](https://github.com/opengovsg/FormSG/commit/c1c7ac29e6bd8e2c3ab80b2fde22f84b778f1b4f) +- fix: correcting submission button bug for MRF [`96628aa`](https://github.com/opengovsg/FormSG/commit/96628aa3b4dd5abae00b429486139431a8b3bf05) #### [v6.114.0](https://github.com/opengovsg/FormSG/compare/v6.113.0...v6.114.0) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 278e5928ff..004e6399d8 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "form-frontend", - "version": "6.114.1", + "version": "6.115.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "form-frontend", - "version": "6.114.1", + "version": "6.115.1", "hasInstallScript": true, "dependencies": { "@chakra-ui/react": "^1.8.6", diff --git a/frontend/package.json b/frontend/package.json index 8d48db8602..69e080b64d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "form-frontend", - "version": "6.114.1", + "version": "6.115.1", "homepage": ".", "private": true, "dependencies": { diff --git a/package-lock.json b/package-lock.json index c3e848d4b0..1d986c39b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "FormSG", - "version": "6.114.1", + "version": "6.115.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "FormSG", - "version": "6.114.1", + "version": "6.115.1", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudwatch-logs": "^3.536.0", diff --git a/package.json b/package.json index 1a2762f342..15ce497518 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "FormSG", "description": "Form Manager for Government", - "version": "6.114.1", + "version": "6.115.1", "homepage": "https://form.gov.sg", "authors": [ "FormSG " diff --git a/src/app/modules/form/admin-form/__tests__/admin-form.service.spec.ts b/src/app/modules/form/admin-form/__tests__/admin-form.service.spec.ts index 2d78ff912f..2572faad4b 100644 --- a/src/app/modules/form/admin-form/__tests__/admin-form.service.spec.ts +++ b/src/app/modules/form/admin-form/__tests__/admin-form.service.spec.ts @@ -20,6 +20,7 @@ import { DatabaseError, DatabasePayloadSizeError, DatabaseValidationError, + MalformedParametersError, } from 'src/app/modules/core/core.errors' import { MissingUserError } from 'src/app/modules/user/user.errors' import * as UserService from 'src/app/modules/user/user.service' @@ -1419,6 +1420,47 @@ describe('admin-form.service', () => { ) expect(MOCK_UPDATED_FORM.getSettings).toHaveBeenCalledTimes(0) }) + + it('should not allow webhooks updates for MRF', async () => { + const MOCK_MULTIRESPONDENT_FORM = jest.mocked({ + _id: new ObjectId(), + status: FormStatus.Public, + responseMode: FormResponseMode.Multirespondent, + } as unknown as IPopulatedForm) + const settingsToUpdate: SettingsUpdateDto = { + webhook: { + url: 'does not matter', + }, + } + + // Act + const actualResult = await AdminFormService.updateFormSettings( + MOCK_MULTIRESPONDENT_FORM, + settingsToUpdate, + ) + + // Assert + expect(actualResult._unsafeUnwrapErr()).toBeInstanceOf( + MalformedParametersError, + ) + }) + + it('should allow webhooks updates for encrypt form', async () => { + const settingsToUpdate: SettingsUpdateDto = { + webhook: { + url: 'does not matter', + }, + } + + // Act + const actualResult = await AdminFormService.updateFormSettings( + MOCK_ENCRYPT_FORM, + settingsToUpdate, + ) + + // Assert + expect(actualResult.isOk()).toBeTrue() + }) }) describe('updateFormField', () => { diff --git a/src/app/modules/form/admin-form/admin-form.service.ts b/src/app/modules/form/admin-form/admin-form.service.ts index a2466c32b3..2263553309 100644 --- a/src/app/modules/form/admin-form/admin-form.service.ts +++ b/src/app/modules/form/admin-form/admin-form.service.ts @@ -1041,6 +1041,7 @@ export const updateFormCollaborators = ( * @param body the subset of form settings to update * @returns ok(updated form settings) on success * @returns err(MalformedParametersError) if auth type update is attempted for a multi-respondent form + * @returns err(MalformedParametersError) if webhook update is attempted for a multi-respondent form * @returns err(database errors) if db error is thrown during form setting update */ export const updateFormSettings = ( @@ -1063,6 +1064,15 @@ export const updateFormSettings = ( return errAsync(new MalformedParametersError('Invalid authentication type')) } + if ( + originalForm.responseMode === FormResponseMode.Multirespondent && + Boolean(body.webhook?.url) + ) { + return errAsync( + new MalformedParametersError('Webhooks not supported on MRF'), + ) + } + const dotifiedSettingsToUpdate = dotifyObject(body) const ModelToUse = getFormModelByResponseMode(originalForm.responseMode)