Skip to content

Commit

Permalink
Fix session id collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Sep 1, 2016
1 parent c97ad2f commit eb49a72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Session/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function setId($id)
*/
public function isValidId($id)
{
return is_string($id) && preg_match('/^[a-f0-9]{40}$/', $id);
return is_string($id) && ctype_alnum($id) && strlen($id) === 40;
}

/**
Expand All @@ -194,7 +194,7 @@ public function isValidId($id)
*/
protected function generateSessionId()
{
return sha1(uniqid('', true).Str::random(25).microtime(true));
return Str::random(40);
}

/**
Expand Down

0 comments on commit eb49a72

Please sign in to comment.