Skip to content

Commit

Permalink
Use timing safe string comparison in CSRF filter
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Nov 11, 2014
1 parent 09f93d1 commit e1b8833
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/filters.php
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Session;
use Orchestra\Support\Facades\App;
use Symfony\Component\Security\Core\Util\StringUtils;

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -58,7 +59,7 @@
// differently or deleted by the user. To avoid un-expected behaviour
// the same functionality is duplicated.

if (Session::token() !== Input::get('_token')) {
if (! StringUtils::equals(Session::token(), Input::get('_token'))) {
throw new TokenMismatchException;
}
});
Expand Down

0 comments on commit e1b8833

Please sign in to comment.