diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-08-08 08:55:46 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-08-08 09:02:21 +0200 |
commit | 5def04bce0104062640f87f4b9d47f500d24e5be (patch) | |
tree | 73241e8f676f466b4c352f3c82fd14e6adca4a1b | |
parent | 4c6a3d7d8ac56b9fea777781b291cfde956a7e9a (diff) |
- Fix (disable) request validation for spell and spell_html actions
Consider action whitelist also for ajax requests
Conflicts:
CHANGELOG
index.php
-rw-r--r-- | CHANGELOG | 4 | ||||
-rw-r--r-- | index.php | 40 |
2 files changed, 24 insertions, 20 deletions
@@ -1,6 +1,10 @@ CHANGELOG Roundcube Webmail =========================== +- Fix (disable) request validation for spell and spell_html actions + +RELEASE 0.8.0 +------------- - Don't show product version on login screen (can be enabled by config) - Renamed old default skin to 'classic'. Larry is the new default skin. - Support connections to memcached socket file (#1488577) @@ -220,28 +220,28 @@ if (empty($RCMAIL->user->ID)) { } // CSRF prevention else { - // don't check for valid request tokens in these actions - $request_check_whitelist = array('login'=>1, 'spell'=>1); - - // check client X-header to verify request origin - if ($OUTPUT->ajax_call) { - if (rc_request_header('X-Roundcube-Request') != $RCMAIL->get_request_token()) { - header('HTTP/1.1 403 Forbidden'); - die("Invalid Request"); + $request_check_whitelist = array('login'=>1, 'spell'=>1, 'spell_html'=>1); + + if (!$request_check_whitelist[$RCMAIL->action]) { + // check client X-header to verify request origin + if ($OUTPUT->ajax_call) { + if (rc_request_header('X-Roundcube-Request') != $RCMAIL->get_request_token()) { + header('HTTP/1.1 403 Forbidden'); + die("Invalid Request"); + } + } + // check request token in POST form submissions + else if (!empty($_POST) && !$RCMAIL->check_request()) { + $OUTPUT->show_message('invalidrequest', 'error'); + $OUTPUT->send($RCMAIL->task); } - } - // check request token in POST form submissions - else if (!empty($_POST) && !$request_check_whitelist[$RCMAIL->action] && !$RCMAIL->check_request()) { - $OUTPUT->show_message('invalidrequest', 'error'); - $OUTPUT->send($RCMAIL->task); - } - // check referer if configured - if (!$request_check_whitelist[$RCMAIL->action] && $RCMAIL->config->get('referer_check') && !rcube_check_referer()) { - raise_error(array( - 'code' => 403, - 'type' => 'php', - 'message' => "Referer check failed"), true, true); + // check referer if configured + if ($RCMAIL->config->get('referer_check') && !rcube_check_referer()) { + raise_error(array( + 'code' => 403, 'type' => 'php', + 'message' => "Referer check failed"), true, true); + } } } |