Skip to content

Commit

Permalink
Merge pull request #6800 from opengovsg/release_v6.82.0
Browse files Browse the repository at this point in the history
build: release v6.82.0
  • Loading branch information
tshuli authored Oct 16, 2023
2 parents 380593c + 9b23483 commit d850d31
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
path: '**/node_modules'
key: ${{ runner.OS }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- run: npm ci --prefix serverless/virus-scanner
- run: npm run test:backend
- run: npm run test:backend:ci
env:
NODE_OPTIONS: '--max-old-space-size=4096'
- name: Coveralls
Expand Down
29 changes: 23 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,34 @@ 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.82.0](https://github.com/opengovsg/FormSG/compare/v6.82.0...v6.82.0)

#### [v6.82.0](https://github.com/opengovsg/FormSG/compare/v6.81.0...v6.82.0)

> 16 October 2023

- chore: improve nric/fin error message [`#6796`](https://github.com/opengovsg/FormSG/pull/6796)
- fix(gogov): reset GoGov states in share modal [`#6776`](https://github.com/opengovsg/FormSG/pull/6776)
- fix: add payment data to virus scanner endpoint [`#6789`](https://github.com/opengovsg/FormSG/pull/6789)
- chore: return InvalidFileKeyError if file not found [`#6787`](https://github.com/opengovsg/FormSG/pull/6787)
- feat(virus-scanner): happy path logging [`#6779`](https://github.com/opengovsg/FormSG/pull/6779)
- build: merge release v6.81.0 into develop [`#6780`](https://github.com/opengovsg/FormSG/pull/6780)
- fix(deps): bump type-fest from 4.3.1 to 4.4.0 in /shared [`#6782`](https://github.com/opengovsg/FormSG/pull/6782)
- chore(ci): backend jest config [`#6772`](https://github.com/opengovsg/FormSG/pull/6772)
- build: release v6.81.0 [`#6777`](https://github.com/opengovsg/FormSG/pull/6777)
- chore: bump version to v6.82.0 [`5dab965`](https://github.com/opengovsg/FormSG/commit/5dab965019d626ccd3ff6ef20f4d9f6c386db8c8)

#### [v6.81.0](https://github.com/opengovsg/FormSG/compare/v6.80.0...v6.81.0)

> 5 October 2023

- feat(virus-scanner): frontend orchestration [`#6767`](https://github.com/opengovsg/FormSG/pull/6767)
- feat: add well-known domain [`#6774`](https://github.com/opengovsg/FormSG/pull/6774)
- build: merge release v6.80.0 into develop [`#6775`](https://github.com/opengovsg/FormSG/pull/6775)
- build: release v6.80.0 [`#6773`](https://github.com/opengovsg/FormSG/pull/6773)
- fix(deps): bump zod from 3.22.2 to 3.22.3 in /shared [`#6768`](https://github.com/opengovsg/FormSG/pull/6768)
- fix(deps): bump zod from 3.21.4 to 3.22.3 [`#6769`](https://github.com/opengovsg/FormSG/pull/6769)
- chore: bump version to v6.81.0 [`f059d44`](https://github.com/opengovsg/FormSG/commit/f059d440b4159706f92f7604566ee4a024c41055)

#### [v6.80.0](https://github.com/opengovsg/FormSG/compare/v6.79.0...v6.80.0)

Expand Down Expand Up @@ -77,20 +97,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- feat: add logging to check for missing Myinfo field values [`#6694`](https://github.com/opengovsg/FormSG/pull/6694)
- build: merge v6.77.0 into develop [`#6711`](https://github.com/opengovsg/FormSG/pull/6711)
- build: release v6.77.0 [`#6710`](https://github.com/opengovsg/FormSG/pull/6710)
- build: merge v6.76.1 into develop [`#6708`](https://github.com/opengovsg/FormSG/pull/6708)
- build: release v6.76.1 [`#6702`](https://github.com/opengovsg/FormSG/pull/6702)
- fix: invalid mixed digit input [`#6701`](https://github.com/opengovsg/FormSG/pull/6701)
- chore: bump version to v6.78.0 [`f8fa1ec`](https://github.com/opengovsg/FormSG/commit/f8fa1ecbb3a5dfad3735ee01420f27967d174112)
- chore: bump version to 6.76.1 [`9e88567`](https://github.com/opengovsg/FormSG/commit/9e8856721af4e3a99b6c6fe0e31ac96414a46149)
- chore: bump version to v6.77.0 [`6b1b9b2`](https://github.com/opengovsg/FormSG/commit/6b1b9b2ed04e6bd0cdf632c642724c906062b3ac)

#### [v6.77.0](https://github.com/opengovsg/FormSG/compare/v6.76.1...v6.77.0)

> 12 September 2023

- build: merge v6.76.1 into develop [`#6708`](https://github.com/opengovsg/FormSG/pull/6708)
- feat: soften and fix storage submission validation [`#6696`](https://github.com/opengovsg/FormSG/pull/6696)
- build: release v6.76.1 [`#6702`](https://github.com/opengovsg/FormSG/pull/6702)
- build: merge v6.76.0 into develop [`#6700`](https://github.com/opengovsg/FormSG/pull/6700)
- chore: bump version to v6.77.0 [`25876be`](https://github.com/opengovsg/FormSG/commit/25876be292b08d97c0fa14ca0ec07a78298d5f5a)
- chore: bump version to v6.77.0 [`6b1b9b2`](https://github.com/opengovsg/FormSG/commit/6b1b9b2ed04e6bd0cdf632c642724c906062b3ac)

#### [v6.76.1](https://github.com/opengovsg/FormSG/compare/v6.76.0...v6.76.1)

Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-frontend",
"version": "6.81.0",
"version": "6.82.0",
"homepage": ".",
"private": true,
"dependencies": {
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/features/admin-form/share/ShareFormModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,15 @@ export const ShareFormModal = ({
setGoLinkSuffixInput(goLinkSuffixData?.goLinkSuffix ?? '')
setGoLinkHelperText(goLinkClaimSuccessHelperText)
}
return () => {
// before unmount or after any changes to goLinkSuffix, will reset the states first
setGoLinkSaved(false)
setGoLinkSuffixInput('')
setGoLinkHelperText(undefined)
}
}, [goLinkSuffixData?.goLinkSuffix])

const { claimGoLinkMutation } = useListShortenerMutations()
const { claimGoLinkMutation } = useListShortenerMutations(formId ?? '')

const [goLinkHelperText, setGoLinkHelperText] = useState<
goLinkHelperTextType | undefined
Expand All @@ -209,7 +215,6 @@ export const ShareFormModal = ({
setClaimGoLoading(true)
await claimGoLinkMutation.mutateAsync({
linkSuffix: goLinkSuffixInput,
formId: formId ?? '',
adminEmail: user.email,
})
setClaimGoLoading(false)
Expand All @@ -236,7 +241,7 @@ export const ShareFormModal = ({
setGoLinkHelperText(getGoLinkClaimFailureHelperText(errMessage))
return
}
}, [user, claimGoLinkMutation, goLinkSuffixInput, formId])
}, [user, claimGoLinkMutation, goLinkSuffixInput])

const FormLinkSection = () => (
<FormControl isReadOnly>
Expand Down
19 changes: 8 additions & 11 deletions frontend/src/features/link-shortener/mutations.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { useMutation } from 'react-query'
import { useMutation, useQueryClient } from 'react-query'

import { claimGoLink } from './GoGovService'
import { goGovKeys } from './queries'

export const useListShortenerMutations = (formId: string) => {
const queryClient = useQueryClient()

export const useListShortenerMutations = () => {
const claimGoLinkMutation = useMutation(
({
linkSuffix,
formId,
adminEmail,
}: {
linkSuffix: string
formId: string
adminEmail: string
}) => claimGoLink(linkSuffix, formId, adminEmail),
({ linkSuffix, adminEmail }: { linkSuffix: string; adminEmail: string }) =>
claimGoLink(linkSuffix, formId, adminEmail),
{ onSuccess: () => queryClient.invalidateQueries(goGovKeys.id(formId)) },
)

return { claimGoLinkMutation }
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/features/link-shortener/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import { useQuery, UseQueryResult } from 'react-query'

import { getGoLinkSuffix } from './GoGovService'

export const goGovKeys = {
id: (id: string) => ['gogov', id] as const,
}

export const useGoLink = (
formId: string,
): UseQueryResult<{ goLinkSuffix: string }> => {
return useQuery(formId, () => getGoLinkSuffix(formId), {
return useQuery(goGovKeys.id(formId), () => getGoLinkSuffix(formId), {
enabled: !!formId,
})
}
9 changes: 8 additions & 1 deletion frontend/src/features/public-form/PublicFormProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,10 @@ export const PublicFormProvider = ({
// TODO (FRM-1413): Move to main return statement once virus scanner has been fully rolled out
if (enableEncryptionBoundaryShift && enableVirusScanner) {
return submitStorageModeClearFormWithVirusScanningMutation.mutateAsync(
formData,
{
...formData,
...formPaymentData,
},
{
onSuccess: ({
submissionId,
Expand Down Expand Up @@ -676,11 +679,15 @@ export const PublicFormProvider = ({
submitEmailModeFormFetchMutation,
submitEmailModeFormMutation,
enableEncryptionBoundaryShift,
enableVirusScanner,
submitStorageModeClearFormMutation,
submitStorageModeFormMutation,
submitStorageModeClearFormFetchMutation,
submitStorageModeFormFetchMutation,
navigate,
formId,
storePaymentMemory,
submitStorageModeClearFormWithVirusScanningMutation,
],
)

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/templates/Field/Nric/NricField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('NRIC validation', () => {

// Assert
// Should show error message.
const error = screen.getByText('Please enter a valid NRIC')
const error = screen.getByText('Please enter a valid NRIC/FIN')
expect(error).not.toBeNull()
})
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/fieldValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export const createNricValidationRules: ValidationRuleFn<NricFieldBase> = (
return (
isNricValid(val) ||
isMFinSeriesValid(val) ||
'Please enter a valid NRIC'
'Please enter a valid NRIC/FIN'
)
},
},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "FormSG",
"description": "Form Manager for Government",
"version": "6.81.0",
"version": "6.82.0",
"homepage": "https://form.gov.sg",
"authors": [
"FormSG <[email protected]>"
Expand All @@ -27,6 +27,7 @@
"postinstall": "npm run postinstall:frontend && npm run postinstall:shared",
"test": "npm run test:backend && npm run test:frontend",
"test:backend": "env-cmd -f __tests__/setup/.test-env jest",
"test:backend:ci": "env-cmd -f __tests__/setup/.test-env jest --maxWorkers=2 --logHeapUsage --workerIdleMemoryLimit=0.2",
"test:backend:watch": "env-cmd -f __tests__/setup/.test-env jest --watch",
"test:frontend": "npm --prefix frontend test",
"test:e2e-v2": "npm run build && npx playwright test",
Expand Down
12 changes: 6 additions & 6 deletions shared/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1438,9 +1438,7 @@ describe('encrypt-submission.service', () => {
// Assert
expect(awsSpy).toHaveBeenCalledOnce()
expect(actualResult.isErr()).toEqual(true)
expect(actualResult._unsafeUnwrapErr()).toEqual(
new VirusScanFailedError(),
)
expect(actualResult._unsafeUnwrapErr()).toEqual(new InvalidFileKeyError())
})

it("should return errAsync if the lambda's errored response is not in the right format", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { StatusCodes } from 'http-status-codes'
import { chain, omit } from 'lodash'
import { ok, okAsync, Result, ResultAsync } from 'neverthrow'

import { featureFlags } from '../../../../../shared/constants'
import {
featureFlags,
VIRUS_SCANNER_SUBMISSION_VERSION,
} from '../../../../../shared/constants'
import {
BasicField,
StorageModeAttachment,
Expand Down Expand Up @@ -305,7 +308,7 @@ export const scanAndRetrieveAttachments = async (

if (!virusScannerEnabled) {
logger.warn({
message: 'Virus scanner is not enabled.',
message: 'Virus scanner is not enabled on BE.',
meta: logMeta,
})

Expand All @@ -317,7 +320,18 @@ export const scanAndRetrieveAttachments = async (
// should have virus scanning enabled. If not, skip this middleware.
// Note: Version number is sent by the frontend and should only be >=2.1 if virus scanning is enabled on the frontend.

if (req.body.version < 2.1) return next()
if (req.body.version < VIRUS_SCANNER_SUBMISSION_VERSION) {
logger.warn({
message: 'Virus scanner is not enabled on FE.',
meta: logMeta,
})
return next()
}

logger.info({
message: 'Virus scanner is enabled on both BE and FE.',
meta: logMeta,
})

// At this point, virus scanner is enabled and storage submission v2.1+. This means that both the FE and BE
// have virus scanning enabled.
Expand Down Expand Up @@ -353,6 +367,11 @@ export const scanAndRetrieveAttachments = async (
})
}

logger.info({
message: 'Successfully scanned and downloaded clean attachments',
meta: logMeta,
})

// Step 5: Replace req.body.responses with the new responses with populated attachments.
req.body.responses = scanAndRetrieveFilesResult.value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,10 @@ export const triggerVirusScanning = (
})

if (error instanceof ParseVirusScannerLambdaPayloadError) return error
else if (error.statusCode === StatusCodes.NOT_FOUND)
return new InvalidFileKeyError(
'Invalid file key - file key is not found in the quarantine bucket. The file must be uploaded first.',
)
else if (error.statusCode !== StatusCodes.BAD_REQUEST)
return new VirusScanFailedError()

Expand Down
3 changes: 2 additions & 1 deletion src/app/modules/submission/receiver/receiver.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IncomingHttpHeaders } from 'http'
import { err, ok, Result, ResultAsync } from 'neverthrow'
import { FormResponseMode } from 'shared/types'

import { VIRUS_SCANNER_SUBMISSION_VERSION } from '../../../../../shared/constants'
import { MB } from '../../../../../shared/constants/file'
import { IAttachmentInfo } from '../../../../types'
import { createLoggerWithLabel } from '../../../config/logger'
Expand Down Expand Up @@ -159,7 +160,7 @@ export const configureMultipartReceiver = (
// TODO (FRM-1413): change to a version existence guardrail when
// virus scanning has completed rollout, so that virus scanning
// cannot be bypassed on storage mode submissions.
(body.version ?? 0) >= 2.1,
(body.version ?? 0) >= VIRUS_SCANNER_SUBMISSION_VERSION,
)
return resolve(body)
} else {
Expand Down

0 comments on commit d850d31

Please sign in to comment.