Skip to content

Commit

Permalink
Add session token checking to various admin pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Oct 19, 2015
1 parent 33ddcc7 commit 0583e53
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion horde/admin/cmdshell.php
Expand Up @@ -27,8 +27,9 @@
$view->action = Horde::url('admin/cmdshell.php');
$view->command = trim(Horde_Util::getFormData('cmd'));
$view->title = $title;

$view->session = $session;
if ($view->command) {
$session->checkToken(Horde_Util::getPost('token'));
$cmds = explode("\n", $view->command);
$out = array();

Expand Down
2 changes: 2 additions & 0 deletions horde/admin/phpshell.php
Expand Up @@ -48,8 +48,10 @@
$view->apps = $apps;
$view->command = $command;
$view->title = $title;
$view->session = $session;

if ($command) {
$session->checkToken($vars->token);
$pushed = $registry->pushApp($application);

$part = new Horde_Mime_Part();
Expand Down
5 changes: 4 additions & 1 deletion horde/admin/sqlshell.php
Expand Up @@ -22,7 +22,9 @@
$q_cache = $session->get('horde', 'sql_query_cache', Horde_Session::TYPE_ARRAY);
$title = _("SQL Shell");
$vars = $injector->getInstance('Horde_Variables');

if ($vars->get('list-tables') || ($command = trim($vars->sql))) {
$session->checkToken($vars->token);
}
if ($vars->get('list-tables')) {
$description = 'LIST TABLES';
$result = $db->tables();
Expand All @@ -48,6 +50,7 @@
$view = new Horde_View(array(
'templatePath' => HORDE_TEMPLATES . '/admin'
));
$view->session = $session;
$view->addHelper('Horde_Core_View_Helper_Help');
$view->addHelper('Text');

Expand Down
2 changes: 2 additions & 0 deletions horde/templates/admin/cmdshell.html.php
Expand Up @@ -11,6 +11,8 @@
<?php endif; ?>

<form action="<?php echo $this->action ?>" method="post">
<?php Horde_Util::pformInput() ?>
<input type="hidden" name="token" value="<?php echo $this->session->getToken() ?>" />
<h1 class="header"><?php echo $this->title ?></h1>

<div class="horde-content">
Expand Down
2 changes: 2 additions & 0 deletions horde/templates/admin/phpshell.html.php
@@ -1,4 +1,6 @@
<form action="<?php echo $this->action ?>" method="post">
<?php Horde_Util::pformInput() ?>
<input type="hidden" name="token" value="<?php echo $this->session->getToken() ?>" />
<h1 class="header"><?php echo $this->h($this->title) ?></h1>

<div class="horde-content">
Expand Down
2 changes: 2 additions & 0 deletions horde/templates/admin/sqlshell.html.php
@@ -1,6 +1,8 @@
<h1 class="header"><?php echo $this->title ?></h1>

<form name="sqlshell" action="<?php echo $this->action ?>" method="post">
<?php Horde_Util::pformInput() ?>
<input type="hidden" name="token" value="<?php echo $this->session->getToken() ?>" />
<div class="horde-content">
<?php if ($this->results): ?>
<?php if ($this->command): ?>
Expand Down

0 comments on commit 0583e53

Please sign in to comment.