From 01af755d18decb5669aa37bddb7a090569286553 Mon Sep 17 00:00:00 2001 From: Drew Gross Date: Thu, 31 Mar 2016 18:49:58 -0700 Subject: [PATCH] Accept only bool for $exists in LiveQuery --- src/LiveQuery/QueryTools.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/LiveQuery/QueryTools.js b/src/LiveQuery/QueryTools.js index adbc4deece..8a47f25c79 100644 --- a/src/LiveQuery/QueryTools.js +++ b/src/LiveQuery/QueryTools.js @@ -208,6 +208,11 @@ function matchesKeyConstraints(object, key, constraints) { case '$exists': let propertyExists = typeof object[key] !== 'undefined'; let existenceIsRequired = constraints['$exists']; + if (typeof constraints['$exists'] !== 'boolean') { + // The SDK will never submit a non-boolean for $exists, but if someone + // tries to submit a non-boolean for $exits outside the SDKs, just ignore it. + break; + } if ((!propertyExists && existenceIsRequired) || (propertyExists && !existenceIsRequired)) { return false; }