From d66ecdfad6958014a05e2a28a820a3492d9f4990 Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 28 Jul 2026 11:42:07 +0200 Subject: [PATCH] Fix: various minor fixes and hardening --- CHANGELOG.md | 6 ++++++ ajax/extract_json.php | 2 +- inc/apiclient.class.php | 2 +- inc/config.class.php | 28 ++++++++++++++++++++++++---- inc/dashboard.class.php | 5 +++-- setup.php | 2 +- 6 files changed, 36 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7058b61..0e83ea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Fixed + +- Various minor fixes and hardening + ## [1.4.1] - 2025-11-25 ### Fixed diff --git a/ajax/extract_json.php b/ajax/extract_json.php index 67f8d6a..fc3b43c 100644 --- a/ajax/extract_json.php +++ b/ajax/extract_json.php @@ -30,7 +30,7 @@ header('Content-Type: text/html; charset=UTF-8'); Html::header_nocache(); -Session::checkLoginUser(); +Session::checkRight('config', READ); if ( !isset($_REQUEST['id']) diff --git a/inc/apiclient.class.php b/inc/apiclient.class.php index c6d918b..6675668 100644 --- a/inc/apiclient.class.php +++ b/inc/apiclient.class.php @@ -822,7 +822,7 @@ public function httpQuery($resource = '', $params = [], $method = 'GET') 'timeout' => 5, 'connect_timeout' => 2, 'debug' => false, - 'verify' => false, + 'verify' => true, 'query' => [], // url parameter 'body' => '', // raw data to send in body 'json' => [], // json data to send diff --git a/inc/config.class.php b/inc/config.class.php index bbd02fb..8ac029f 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -140,10 +140,11 @@ public static function showForConfig(Config $config, $withtemplate = 0) ]); echo self::showField([ - 'label' => __s('Metabase embedded token (to display dashboard in GLPI)', 'metabase'), - 'attrs' => [ + 'inputtype' => 'password', + 'label' => __s('Metabase embedded token (to display dashboard in GLPI)', 'metabase'), + 'attrs' => [ 'name' => 'embedded_token', - 'value' => $current_config['embedded_token'], + 'value' => '', 'placeholder' => '', 'required' => false, ], @@ -202,7 +203,7 @@ public static function showForConfig(Config $config, $withtemplate = 0) echo ''; $error = $apiclient->getLastError(); - if (count($error) > 0) { + if ($canedit && count($error) > 0) { echo '