postgres: Refuse to build unsafe JSON lists for contains in Postgres (#5337)
This commit is contained in:
committed by
Florent Vilmart
parent
7e48b7a1f1
commit
038d7bd727
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user