π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: avoid reserved keys on merge
mertmita0fafd29186a
diff --git a/packages/nocodb/src/utils/dataUtils.ts b/packages/nocodb/src/utils/dataUtils.tsindex 1506569f53..38c5d3267c 100644--- a/packages/nocodb/src/utils/dataUtils.ts+++ b/packages/nocodb/src/utils/dataUtils.ts@@ -66,6 +66,9 @@ const isMergeableObject = (val: any) => {);};+// Keys that can lead to prototype pollution+const RESERVED_KEYS = new Set(['__proto__', 'constructor', 'prototype']);+/*** Deep merge two objects* @param target target object to merge@@ -80,6 +83,10 @@ export const deepMerge = (target: any, ...sources: any[]) => {if (isMergeableObject(target) && isMergeableObject(source)) {Object.keys(source).forEach((key) => {+ if (RESERVED_KEYS.has(key)) {+ return;+ }+if (isMergeableObject(source[key])) {// if source[key] is array then define target[key] as array else objectif (!target[key]) target[key] = Array.isArray(source[key]) ? [] : {};