summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-27 16:32:51 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-27 16:32:51 +0100
commit648fcf570964ad512d18d6df7e07d5bcec2ae830 (patch)
tree6cd6f15ebefcb3f265d18f8a82756b1fe103ed2e /program/steps
parent222c7de3e17056657fede666e87133ff1ea15eaf (diff)
Whitelist configuration options (user preferences) that can be changed using save-pref command
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/utils/save_pref.inc16
1 files changed, 16 insertions, 0 deletions
diff --git a/program/steps/utils/save_pref.inc b/program/steps/utils/save_pref.inc
index b550ad7ef..7def8733d 100644
--- a/program/steps/utils/save_pref.inc
+++ b/program/steps/utils/save_pref.inc
@@ -21,6 +21,22 @@
$name = get_input_value('_name', RCUBE_INPUT_POST);
$value = get_input_value('_value', RCUBE_INPUT_POST);
+$whitelist = array(
+ 'preview_pane',
+ 'list_cols',
+ 'collapsed_folders',
+ 'collapsed_abooks',
+);
+
+if (!in_array($name, array_merge($whitelist, $RCMAIL->plugins->allowed_prefs))) {
+ raise_error(array('code' => 500, 'type' => 'php',
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => sprintf("Hack attempt detected (user: %s)", $RCMAIL->get_user_name())),
+ true, false);
+
+ $OUTPUT->reset();
+ $OUTPUT->send();
+}
// save preference value
$RCMAIL->user->save_prefs(array($name => $value));