Do not allow to protect default fields (#6439)

* consider default columns

* disallow protecting default fields
This commit is contained in:
Old Grandpa
2020-02-29 02:52:48 +03:00
committed by GitHub
parent 4291f2b22a
commit 6b0efaeffd
2 changed files with 28 additions and 3 deletions

View File

@@ -307,6 +307,13 @@ function validateCLP(
// if the field is in form of array
for (const field of protectedFields) {
// do not alloow to protect default fields
if (defaultColumns._Default[field]) {
throw new Parse.Error(
Parse.Error.INVALID_JSON,
`Default field '${field}' can not be protected`
);
}
// field should exist on collection
if (!Object.prototype.hasOwnProperty.call(fields, field)) {
throw new Parse.Error(