aboutsummaryrefslogtreecommitdiff
path: root/src/Service/Security.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-10-23 23:29:59 +0200
committerpolo <ordipolo@gmx.fr>2026-10-23 23:29:59 +0200
commit126a49185229f248eae8c485b3e16e029ebcb353 (patch)
tree7877918b7067103d667d522883e04f0129a1addc /src/Service/Security.php
parent5a25142d778eafdec33d10d673bd4abc5fe38d1c (diff)
downloadcms-126a49185229f248eae8c485b3e16e029ebcb353.tar.gz
cms-126a49185229f248eae8c485b3e16e029ebcb353.tar.bz2
cms-126a49185229f248eae8c485b3e16e029ebcb353.zip
audit claude code 1, validation formulaire toujours ok, échappement dans URL, quelques htmlspecialchars manquants, fonction Security::validateURLpolo1
Diffstat (limited to 'src/Service/Security.php')
-rw-r--r--src/Service/Security.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Service/Security.php b/src/Service/Security.php
index 0fbd8b7..bb04535 100644
--- a/src/Service/Security.php
+++ b/src/Service/Security.php
@@ -27,6 +27,12 @@ class Security
27 return trim(htmLawed($chaine, self::$configHtmLawed, self::$specHtmLawed)); 27 return trim(htmLawed($chaine, self::$configHtmLawed, self::$specHtmLawed));
28 } 28 }
29 29
30 public static function validateURL(string $link): bool
31 {
32 return filter_var($link, FILTER_VALIDATE_URL) !== false // c'est une URL?
33 && in_array(strtolower(parse_url($link, PHP_URL_SCHEME) ?? ''), ['http', 'https'], true); // PHP_URL_SCHEME pour récupérer le protocole
34 }
35
30 public static function secureFileName(string $chaine): string 36 public static function secureFileName(string $chaine): string
31 { 37 {
32 // sécuriser un nom avec chemin avec basename? 38 // sécuriser un nom avec chemin avec basename?
@@ -83,7 +89,7 @@ class Security
83} 89}
84 90
85// lien sans http:// 91// lien sans http://
86function fixLinks($data) 92function fixLinks(string $data): string
87{ 93{
88 // 1/ 94 // 1/
89 // si une adresse est de type "domaine.fr" sans le http:// devant, le comportement des navigateurs est de rechercher un fichier comme si mon adresse commençait par file:// 95 // si une adresse est de type "domaine.fr" sans le http:// devant, le comportement des navigateurs est de rechercher un fichier comme si mon adresse commençait par file://