From cc187050606aff43ffaa26b1e0ab93aa971d1b13 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Tue, 30 Jun 2026 16:30:06 +0200 Subject: [PATCH] Fix security vulnerabilities --- lib/Controller/AdminController.php | 3 --- lib/Controller/ClientController.php | 1 - lib/Controller/CompanyController.php | 3 --- lib/Controller/ConfigurationController.php | 1 - lib/Controller/CrudController.php | 1 - lib/Controller/DevisController.php | 2 -- lib/Controller/FactureController.php | 1 - lib/Controller/ProduitController.php | 1 - lib/Db/Bdd.php | 10 +++++----- templates/content/configuration.php | 6 ++++-- 10 files changed, 9 insertions(+), 20 deletions(-) diff --git a/lib/Controller/AdminController.php b/lib/Controller/AdminController.php index 784ecbfbe..6562cc402 100755 --- a/lib/Controller/AdminController.php +++ b/lib/Controller/AdminController.php @@ -40,9 +40,6 @@ public function __construct($AppName, } } - /** - * @NoCSRFRequired - */ public function backup(){ try { diff --git a/lib/Controller/ClientController.php b/lib/Controller/ClientController.php index 06463442e..2869f0280 100644 --- a/lib/Controller/ClientController.php +++ b/lib/Controller/ClientController.php @@ -48,7 +48,6 @@ public function getClientbyiddevis($id) { /** * @NoAdminRequired - * @NoCSRFRequired * @UseSession */ #[UseSession] diff --git a/lib/Controller/CompanyController.php b/lib/Controller/CompanyController.php index f98b92e5c..dcd118724 100644 --- a/lib/Controller/CompanyController.php +++ b/lib/Controller/CompanyController.php @@ -16,7 +16,6 @@ public function __construct($AppName, IRequest $request, CompanyService $company /** * @NoAdminRequired - * @NoCSRFRequired * @UseSession */ #[UseSession] @@ -26,7 +25,6 @@ public function createCompany() { /** * @NoAdminRequired - * @NoCSRFRequired * @UseSession */ #[UseSession] @@ -36,7 +34,6 @@ public function deleteCompany() { /** * @NoAdminRequired - * @NoCSRFRequired * @UseSession * @param string $companyID */ diff --git a/lib/Controller/ConfigurationController.php b/lib/Controller/ConfigurationController.php index 3f8146243..cb65ed622 100644 --- a/lib/Controller/ConfigurationController.php +++ b/lib/Controller/ConfigurationController.php @@ -52,7 +52,6 @@ public function getConfiguration() { /** * @NoAdminRequired - * @NoCSRFRequired * @param string $table * @param string $column * @param string $data diff --git a/lib/Controller/CrudController.php b/lib/Controller/CrudController.php index b63b9c489..f4350f0ba 100644 --- a/lib/Controller/CrudController.php +++ b/lib/Controller/CrudController.php @@ -16,7 +16,6 @@ public function __construct($AppName, IRequest $request, DataService $dataServic /** * @NoAdminRequired - * @NoCSRFRequired * @param string $table * @param string $column * @param string $data diff --git a/lib/Controller/DevisController.php b/lib/Controller/DevisController.php index 846dda212..9f86d4c28 100644 --- a/lib/Controller/DevisController.php +++ b/lib/Controller/DevisController.php @@ -40,7 +40,6 @@ public function devisshow($numdevis) { /** * @NoAdminRequired - * @NoCSRFRequired * @UseSession */ #[UseSession] @@ -50,7 +49,6 @@ public function insertDevis() { /** * @NoAdminRequired - * @NoCSRFRequired * @param string $id * @UseSession */ diff --git a/lib/Controller/FactureController.php b/lib/Controller/FactureController.php index a9493674e..b4adb9dbc 100644 --- a/lib/Controller/FactureController.php +++ b/lib/Controller/FactureController.php @@ -40,7 +40,6 @@ public function factureshow($numfacture) { /** * @NoAdminRequired - * @NoCSRFRequired * @UseSession */ #[UseSession] diff --git a/lib/Controller/ProduitController.php b/lib/Controller/ProduitController.php index 7a7c98c2a..3ecc0fc19 100644 --- a/lib/Controller/ProduitController.php +++ b/lib/Controller/ProduitController.php @@ -37,7 +37,6 @@ public function getProduitsById($numdevis) { /** * @NoAdminRequired - * @NoCSRFRequired * @UseSession */ #[UseSession] diff --git a/lib/Db/Bdd.php b/lib/Db/Bdd.php index 5f0e3288b..d7edbf3cd 100644 --- a/lib/Db/Bdd.php +++ b/lib/Db/Bdd.php @@ -216,7 +216,7 @@ public function searchMaxIdProduit($idNextcloud){ * UPDATE */ public function gestion_update($table, $column, $data, $id, $id_configuration) { - if (in_array($table, $this->whiteTable) && in_array($column, $this->whiteColumn)) { + if (in_array($table, $this->whiteTable, true) && in_array($column, $this->whiteColumn, true)) { $safeData = strip_tags($data, '
'); $safeData = html_entity_decode($safeData, ENT_QUOTES, 'UTF-8'); @@ -235,7 +235,7 @@ public function gestion_update($table, $column, $data, $id, $id_configuration) { * UPDATE */ public function gestion_update_configuration($table, $column, $data, $id, $idNextcloud){ - if(in_array($table, $this->whiteTable) && in_array($column, $this->whiteColumn)){ + if(in_array($table, $this->whiteTable, true) && in_array($column, $this->whiteColumn, true)){ $sql = "UPDATE ".$this->tableprefix.$table." SET $column = ? WHERE `id` = ? AND `id_nextcloud` = ?"; $this->execSQLNoData($sql, array(htmlentities(rtrim($data)), $id, $idNextcloud)); return true; @@ -248,7 +248,7 @@ public function gestion_update_configuration($table, $column, $data, $id, $idNex * TODO Autorisation à faire cette action par l'utilisateur */ public function gestion_updateConfiguration($table, $column, $data, $id){ - if(in_array($table, $this->whiteTable) && in_array($column, $this->whiteColumn)){ + if(in_array($table, $this->whiteTable, true) && in_array($column, $this->whiteColumn, true)){ $sql = "UPDATE ".$this->tableprefix.$table." SET $column = ? WHERE `id` = ?"; $this->execSQLNoData($sql, array(htmlentities(rtrim($data)), $id)); return true; @@ -260,7 +260,7 @@ public function gestion_updateConfiguration($table, $column, $data, $id){ * DUPLICATE */ public function gestion_duplicate($table, $id, $CurrentCompany){ - if(in_array($table, $this->whiteTable)){ + if(in_array($table, $this->whiteTable, true)){ $sql = "SELECT * FROM ".$this->tableprefix.$table." WHERE `id` = ? AND `id_configuration` = ?"; $res = $this->execSQLNoJsonReturn($sql, array($id, $CurrentCompany)); @@ -334,7 +334,7 @@ public function gestion_drop($id, $value, $CurrentCompany){ * DELETE */ public function gestion_delete($table, $id, $CurrentCompany){ - if(in_array($table, $this->whiteTable)){ + if(in_array($table, $this->whiteTable, true)){ $sql = "DELETE FROM ".$this->tableprefix.$table." WHERE `id` = ? AND `id_configuration` = ?"; $this->execSQLNoData($sql, array($id, $CurrentCompany)); return true; diff --git a/templates/content/configuration.php b/templates/content/configuration.php index 93a5676f8..b59618c0f 100755 --- a/templates/content/configuration.php +++ b/templates/content/configuration.php @@ -34,9 +34,11 @@ getDisplayName(), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + $uid = htmlspecialchars($user->getUID(), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); echo ''; - echo ''.$user->getDisplayName().''; - echo ''; + echo ''.$displayName.''; + echo ''; echo ''; } ?>