aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Utils.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-09-06 16:16:53 +0200
committerVirtualTam <virtualtam@flibidi.net>2015-09-06 16:16:53 +0200
commitf5d6b19b73cd026cb1d937aab16d48b43e412c77 (patch)
tree8c100e6ca4cba5870640cf3e0ec688b1f0fa7474 /application/Utils.php
parenta02257b8aed58ef2f8536c877ce2fb222f84ac40 (diff)
parent68bc21353a6138a898724c8bb87684bb2b6b2c1c (diff)
downloadShaarli-f5d6b19b73cd026cb1d937aab16d48b43e412c77.tar.gz
Shaarli-f5d6b19b73cd026cb1d937aab16d48b43e412c77.tar.zst
Shaarli-f5d6b19b73cd026cb1d937aab16d48b43e412c77.zip
Merge pull request #338 from virtualtam/fix/unique-uniqid
Session ID: extend the regex to match possible hash representations
Diffstat (limited to 'application/Utils.php')
-rwxr-xr-xapplication/Utils.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/application/Utils.php b/application/Utils.php
index cb03f11c..1422961d 100755
--- a/application/Utils.php
+++ b/application/Utils.php
@@ -140,11 +140,16 @@ function checkPHPVersion($minVersion, $curVersion)
140 140
141/** 141/**
142 * Validate session ID to prevent Full Path Disclosure. 142 * Validate session ID to prevent Full Path Disclosure.
143 *
143 * See #298. 144 * See #298.
145 * The session ID's format depends on the hash algorithm set in PHP settings
144 * 146 *
145 * @param string $sessionId Session ID 147 * @param string $sessionId Session ID
146 * 148 *
147 * @return true if valid, false otherwise. 149 * @return true if valid, false otherwise.
150 *
151 * @see http://php.net/manual/en/function.hash-algos.php
152 * @see http://php.net/manual/en/session.configuration.php
148 */ 153 */
149function is_session_id_valid($sessionId) 154function is_session_id_valid($sessionId)
150{ 155{
@@ -156,7 +161,7 @@ function is_session_id_valid($sessionId)
156 return false; 161 return false;
157 } 162 }
158 163
159 if (!preg_match('/^[a-z0-9]{2,32}$/i', $sessionId)) { 164 if (!preg_match('/^[a-zA-Z0-9,-]{2,128}$/', $sessionId)) {
160 return false; 165 return false;
161 } 166 }
162 167