From c61c7ac15700500174cf6a7164f55e77595c8437 Mon Sep 17 00:00:00 2001 From: Jack Date: Thu, 11 Jun 2020 18:40:02 +0100 Subject: [PATCH] made sure the backend verifies arrays --- functions/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/index.js b/functions/index.js index 112ac4db3..b09bb10c7 100644 --- a/functions/index.js +++ b/functions/index.js @@ -281,7 +281,13 @@ exports.testCompleted = functions.https.onCall((request,response) => { let err = false; Object.keys(obj).forEach(key => { let val = obj[key]; - if(val === undefined || !/^[0-9a-zA-Z._]+$/.test(val)) err = true; + if(Array.isArray(val)){ + val.forEach(valarr => { + if(!/^[0-9a-zA-Z._]+$/.test(valarr)) err = true; + }) + }else{ + if(val === undefined || !/^[0-9a-zA-Z._]+$/.test(val)) err = true; + } }) if (err){ console.error(`error saving result for ${request.uid} - bad input`);