diff --git a/.changeset/thick-flowers-burn.md b/.changeset/thick-flowers-burn.md new file mode 100644 index 0000000000..e39396a609 --- /dev/null +++ b/.changeset/thick-flowers-burn.md @@ -0,0 +1,5 @@ +--- +'directus': patch +--- + +Fix an issue where the validation system could short-circuit when using \_or statements. diff --git a/api/src/services/authorization.ts b/api/src/services/authorization.ts index 8d9c92a69a..e1fb861d08 100644 --- a/api/src/services/authorization.ts +++ b/api/src/services/authorization.ts @@ -274,7 +274,8 @@ export class AuthorizationService { const nestedErrors = flatten( subValidation.map((subObj: Record) => this.validateJoi(subObj, payload)) ); - const allErrored = nestedErrors.every((err?: FailedValidationException) => err); + + const allErrored = subValidation.length === nestedErrors.length; if (allErrored) { errors.push(...nestedErrors);