]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Utils.php
Session ID: extend the regex to match possible hash representations
[github/shaarli/Shaarli.git] / application / Utils.php
index cb03f11c7fd556098674055739a0cf8d8c2300fa..1422961d4a9acb522bf74d87ae848c77ae157cad 100755 (executable)
@@ -140,11 +140,16 @@ function checkPHPVersion($minVersion, $curVersion)
 
 /**
  * Validate session ID to prevent Full Path Disclosure.
+ *
  * See #298.
+ * The session ID's format depends on the hash algorithm set in PHP settings
  *
  * @param string $sessionId Session ID
  *
  * @return true if valid, false otherwise.
+ *
+ * @see http://php.net/manual/en/function.hash-algos.php
+ * @see http://php.net/manual/en/session.configuration.php
  */
 function is_session_id_valid($sessionId)
 {
@@ -156,7 +161,7 @@ function is_session_id_valid($sessionId)
         return false;
     }
 
-    if (!preg_match('/^[a-z0-9]{2,32}$/i', $sessionId)) {
+    if (!preg_match('/^[a-zA-Z0-9,-]{2,128}$/', $sessionId)) {
         return false;
     }