The document controller's uploadDocument action used a flawed validation mechanism to prevent template-type documents from being uploaded to stock movements, shipments, purchase orders, and invoices. While the validation intended to restrict these uploads, it relied on DocumentService.getNonTemplateDocumentTypes() to return DocumentType domain objects and used .contains() to check whether the uploaded document type was in the non-template list.
This allowed an authenticated user with document upload access to bypass the validation and successfully attach forbidden template-type documents to restricted records due to object equality issues with Hibernate entities, dynamic service dependencies, or inverted validation logic.
| Title | CWE | Affected Versions | Fixed In | Patch Date | | -------------------------------------------