From 06bca9395eceb10749af0601eafa4d3f040d3517 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 27 May 2026 14:45:55 +0200 Subject: [PATCH] =?UTF-8?q?fix(ogcore):=20bloquear=20creaci=C3=B3n=20de=20?= =?UTF-8?q?clientes=20y=20OUs=20a=20nivel=20de=20firewall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Añade reglas access_control al firewall de Symfony para los endpoints POST /api/clients y POST /api/organizational-units, restringiendo el acceso a ROLE_SUPER_ADMIN y ROLE_ORGANIZATIONAL_UNIT_ADMIN. La comprobación a nivel de firewall se ejecuta antes de que API Platform procese la petición (antes de deserialización y validación del DTO), lo que garantiza un HTTP 403 inmediato sin necesidad de que el cuerpo de la petición sea válido. Las reglas usan el ancla $ para que no afecten a sub-rutas como /api/clients/server/reboot, /api/clients/server/boot-client, etc. --- config/packages/security.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/packages/security.yaml b/config/packages/security.yaml index a4ce57f..c7edad6 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -39,6 +39,9 @@ security: - { path: ^/validate, roles: PUBLIC_ACCESS } - { path: ^/menu-browser, roles: PUBLIC_ACCESS } - { path: ^/menu/, roles: PUBLIC_ACCESS } + # Creación de clientes y OUs: solo super-admin y ou-admin + - { path: ^/api/clients$, methods: [POST], roles: [ROLE_SUPER_ADMIN, ROLE_ORGANIZATIONAL_UNIT_ADMIN] } + - { path: ^/api/organizational-units$, methods: [POST], roles: [ROLE_SUPER_ADMIN, ROLE_ORGANIZATIONAL_UNIT_ADMIN] } - { path: ^/, roles: ROLE_USER } when@test: