Skip to content

Commit

Permalink
prevent session fixation attacks
Browse files Browse the repository at this point in the history
  • Loading branch information
aheinze committed Sep 26, 2021
1 parent 54423fc commit 0c6628c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/Cockpit/module/auth.php
Expand Up @@ -47,6 +47,8 @@
'setUser' => function($user, $permanent = true) use($app) {

if ($permanent) {
// prevent session fixation attacks
session_regenerate_id(true);
$app('session')->write('cockpit.app.auth', $user);
}

Expand All @@ -73,6 +75,9 @@
'logout' => function() use($app) {
$app->trigger('cockpit.account.logout', [$this->getUser()]);
$app('session')->delete('cockpit.app.auth');

// prevent session fixation attacks
session_regenerate_id(true);
},

'hasaccess' => function($resource, $action, $group = null) use($app) {
Expand Down

0 comments on commit 0c6628c

Please sign in to comment.