From b8fa1d168d6e0be6d88f3e67600a886660bb37fd Mon Sep 17 00:00:00 2001 From: Matthieu Date: Mon, 29 Jun 2026 11:19:12 +0200 Subject: [PATCH 1/2] =?UTF-8?q?fix(rbac)=20:=20ouvre=20la=20liste=20des=20?= =?UTF-8?q?repos=20Gitea=20et=20des=20=C3=A9tag=C3=A8res=20BookStack=20aux?= =?UTF-8?q?=20ROLE=5FUSER?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GiteaRepository (/gitea/repositories) et BookStackShelf (/bookstack/shelves) étaient gardés par ROLE_ADMIN alors que toutes leurs ressources sœurs (branches, pull requests, recherche, liens) sont en ROLE_USER. Un utilisateur non-admin pouvait donc consommer les sous-ressources mais récupérait un 403 en listant les dépôts / étagères racines. Aligné sur ROLE_USER (les *Settings et *TestConnection restent ROLE_ADMIN : configuration réservée à l'admin). --- .../Infrastructure/ApiPlatform/Resource/BookStackShelf.php | 2 +- .../Infrastructure/ApiPlatform/Resource/GiteaRepository.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Module/Integration/Infrastructure/ApiPlatform/Resource/BookStackShelf.php b/src/Module/Integration/Infrastructure/ApiPlatform/Resource/BookStackShelf.php index b7a2c0c..ec55760 100644 --- a/src/Module/Integration/Infrastructure/ApiPlatform/Resource/BookStackShelf.php +++ b/src/Module/Integration/Infrastructure/ApiPlatform/Resource/BookStackShelf.php @@ -15,7 +15,7 @@ use Symfony\Component\Serializer\Attribute\Groups; uriTemplate: '/bookstack/shelves', normalizationContext: ['groups' => ['bookstack_shelf:read']], provider: BookStackShelfProvider::class, - security: "is_granted('ROLE_ADMIN')", + security: "is_granted('ROLE_USER')", ), ], )] diff --git a/src/Module/Integration/Infrastructure/ApiPlatform/Resource/GiteaRepository.php b/src/Module/Integration/Infrastructure/ApiPlatform/Resource/GiteaRepository.php index 2ea8636..6ed68d6 100644 --- a/src/Module/Integration/Infrastructure/ApiPlatform/Resource/GiteaRepository.php +++ b/src/Module/Integration/Infrastructure/ApiPlatform/Resource/GiteaRepository.php @@ -15,7 +15,7 @@ use Symfony\Component\Serializer\Attribute\Groups; uriTemplate: '/gitea/repositories', normalizationContext: ['groups' => ['gitea_repo:read']], provider: GiteaRepositoryProvider::class, - security: "is_granted('ROLE_ADMIN')", + security: "is_granted('ROLE_USER')", ), ], )] -- 2.39.5 From b61574bad2749c879f67afa90dcd50a865322803 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Mon, 29 Jun 2026 11:23:56 +0200 Subject: [PATCH 2/2] fix(rbac) : gate les listes Gitea/BookStack par projects.manage (et non ROLE_USER) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suite à la revue de sécurité : ROLE_ADMIN était trop strict (les ressources sœurs sont en ROLE_USER) mais ROLE_USER brut est trop permissif — ces endpoints listent TOUS les dépôts/étagères visibles par le token d'intégration global, sans filtrage par utilisateur. Comme ils ne sont consommés que par le ProjectDrawer (configuration du dépôt/étagère d'un projet), on les gate sur la permission métier project-management.projects.manage. Les admins conservent l'accès via le bypass ROLE_ADMIN du PermissionVoter. --- .../Infrastructure/ApiPlatform/Resource/BookStackShelf.php | 4 +++- .../Infrastructure/ApiPlatform/Resource/GiteaRepository.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Module/Integration/Infrastructure/ApiPlatform/Resource/BookStackShelf.php b/src/Module/Integration/Infrastructure/ApiPlatform/Resource/BookStackShelf.php index ec55760..13115db 100644 --- a/src/Module/Integration/Infrastructure/ApiPlatform/Resource/BookStackShelf.php +++ b/src/Module/Integration/Infrastructure/ApiPlatform/Resource/BookStackShelf.php @@ -15,7 +15,9 @@ use Symfony\Component\Serializer\Attribute\Groups; uriTemplate: '/bookstack/shelves', normalizationContext: ['groups' => ['bookstack_shelf:read']], provider: BookStackShelfProvider::class, - security: "is_granted('ROLE_USER')", + // Liste toutes les étagères visibles par le token BookStack global : + // réservé à qui configure un projet (ProjectDrawer), pas à tout user. + security: "is_granted('project-management.projects.manage')", ), ], )] diff --git a/src/Module/Integration/Infrastructure/ApiPlatform/Resource/GiteaRepository.php b/src/Module/Integration/Infrastructure/ApiPlatform/Resource/GiteaRepository.php index 6ed68d6..f298509 100644 --- a/src/Module/Integration/Infrastructure/ApiPlatform/Resource/GiteaRepository.php +++ b/src/Module/Integration/Infrastructure/ApiPlatform/Resource/GiteaRepository.php @@ -15,7 +15,9 @@ use Symfony\Component\Serializer\Attribute\Groups; uriTemplate: '/gitea/repositories', normalizationContext: ['groups' => ['gitea_repo:read']], provider: GiteaRepositoryProvider::class, - security: "is_granted('ROLE_USER')", + // Liste l'intégralité des dépôts visibles par le token Gitea global : + // réservé à qui configure un projet (ProjectDrawer), pas à tout user. + security: "is_granted('project-management.projects.manage')", ), ], )] -- 2.39.5