diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-12-05 15:10:32 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-12-05 15:12:28 +0100 |
commit | becde58952e7c9d1bf0a66de84c166fbfac8e7b4 (patch) | |
tree | 29e1134b70ec4ff292a9cbe4755a6eb60493899b /settings/ajax/enableapp.php | |
parent | 8adf61772676bfe71e338fc1c009359135eb381e (diff) | |
download | nextcloud-server-becde58952e7c9d1bf0a66de84c166fbfac8e7b4.tar.gz nextcloud-server-becde58952e7c9d1bf0a66de84c166fbfac8e7b4.zip |
Add sudo mode to enabling and disabling apps
Otherwise an administrator could bypass sudo mode by installing an app that allows RCE by design. I've by intention excluded the update endpoint from the requirement because updating apps should be as unintruisive as possible.
Not the cleanest approach by adding this to the AJAX endpoints instead of requiring a controller but for 11 this felt safer for me. We can clean this up together later then. (also the other AJAX endpoints in this folder do have the same logic)
Ref https://github.com/nextcloud/server/issues/2487
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'settings/ajax/enableapp.php')
-rw-r--r-- | settings/ajax/enableapp.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/settings/ajax/enableapp.php b/settings/ajax/enableapp.php index cf1b7f29db5..b6d62671a63 100644 --- a/settings/ajax/enableapp.php +++ b/settings/ajax/enableapp.php @@ -28,6 +28,13 @@ OC_JSON::checkAdminUser(); OCP\JSON::callCheck(); +$lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm'); +if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay + $l = \OC::$server->getL10N('core'); + OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required')))); + exit(); +} + $groups = isset($_POST['groups']) ? (array)$_POST['groups'] : null; try { |