postgres: Refuse to build unsafe JSON lists for contains in Postgres (#5337)

This commit is contained in:
Steve Clay
2019-01-31 12:23:40 -05:00
committed by Florent Vilmart
parent 7e48b7a1f1
commit 038d7bd727

View File

@@ -282,6 +282,12 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => {
name = transformDotFieldToComponents(fieldName).join('->');
fieldValue.$in.forEach(listElem => {
if (typeof listElem === 'string') {
if (listElem.includes('"') || listElem.includes("'")) {
throw new Parse.Error(
Parse.Error.INVALID_JSON,
'bad $in value; Strings with quotes cannot yet be safely escaped'
);
}
inPatterns.push(`"${listElem}"`);
} else {
inPatterns.push(`${listElem}`);