Skip to content

Commit

Permalink
fix: add payment data to virus scanner endpoint (#6789)
Browse files Browse the repository at this point in the history
* fix: add payment data to virus scanner endpoint

* chore: add missing callback deps

* chore: replace stray 2.1s with constants

* fix: shared/constants import
  • Loading branch information
LinHuiqing authored Oct 11, 2023
1 parent 8ee2db9 commit be434e0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
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
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 @@ -317,7 +320,7 @@ 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) {
if (req.body.version < VIRUS_SCANNER_SUBMISSION_VERSION) {
logger.warn({
message: 'Virus scanner is not enabled on FE.',
meta: logMeta,
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 be434e0

Please sign in to comment.