Skip to content

Commit

Permalink
sec(Logout) add CSRF check
Browse files Browse the repository at this point in the history
  • Loading branch information
joebordes committed Dec 4, 2021
1 parent efd9a7b commit a7d0185
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Smarty/templates/Header.tpl
Expand Up @@ -318,7 +318,7 @@
</a>
</li>
<li class="slds-dropdown__item" role="presentation">
<a href="index.php?module=Users&action=Logout" role="menuitem" tabindex="-1">
<a href="index.php?module=Users&action=Logout&{$CSRFNAME}={''|csrf_get_tokens}" role="menuitem" tabindex="-1">
<span class="slds-truncate" title="{$APP.LBL_LOGOUT}">{$APP.LBL_LOGOUT}</span>
</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions modules/Users/Logout.php
Expand Up @@ -14,6 +14,9 @@
require_once 'include/utils/Session.php';
include_once 'include/integrations/saml/saml.php';
global $adb,$current_user;
$_SERVER['REQUEST_METHOD'] = 'POST';
$_POST[$GLOBALS['csrf']['input-name']] = empty($_REQUEST[$GLOBALS['csrf']['input-name']]) ? '' : $_REQUEST[$GLOBALS['csrf']['input-name']];
Vtiger_Request::validateRequest();

// Recording Logout Info
$loghistory=new LoginHistory();
Expand Down
1 change: 1 addition & 0 deletions modules/Vtiger/header.php
Expand Up @@ -25,6 +25,7 @@
$smarty->assign('THEME', $theme);
$smarty->assign('IMAGEPATH', $image_path);
$smarty->assign('USER', $userName);
$smarty->assign('CSRFNAME', $GLOBALS['csrf']['input-name']);

$qc_modules = getQuickCreateModules();
uasort($qc_modules, function ($a, $b) {
Expand Down

0 comments on commit a7d0185

Please sign in to comment.