From e67222bf27a4551cfdaacebc9d0f128d5b501a6d Mon Sep 17 00:00:00 2001 From: tiffanyvu Date: Tue, 21 Jan 2025 13:20:33 -0800 Subject: [PATCH] validate id --- lib/lambda/submit/submitSplitSPA.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/lambda/submit/submitSplitSPA.ts b/lib/lambda/submit/submitSplitSPA.ts index ea02240bd..21e9292fe 100644 --- a/lib/lambda/submit/submitSplitSPA.ts +++ b/lib/lambda/submit/submitSplitSPA.ts @@ -36,7 +36,12 @@ const sendSubmitSplitSPAMessage = async (currentPackage: ItemResult) => { }; const splitSPAEventBodySchema = z.object({ - packageId: z.string(), + packageId: z + .string() + .regex( + /^[A-Z]{2}-\d{2}-\d{4}(-[A-Z0-9]{1,4})?$/, + "ID doesn't match format SS-YY-NNNN or SS-YY-NNNN-XXXX", + ), }); export const handler = async (event: APIGatewayEvent) => {