From becde58952e7c9d1bf0a66de84c166fbfac8e7b4 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Mon, 5 Dec 2016 15:10:32 +0100 Subject: 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 --- settings/js/apps.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'settings/js') diff --git a/settings/js/apps.js b/settings/js/apps.js index 451becc67a0..7c911427fa8 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -269,6 +269,11 @@ OC.Settings.Apps = OC.Settings.Apps || { }, enableApp:function(appId, active, element, groups) { + if (OC.PasswordConfirmation.requiresPasswordConfirmation()) { + OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.enableApp, this, appId, active, element, groups)); + return; + } + var self = this; OC.Settings.Apps.hideErrorMessage(appId); groups = groups || []; @@ -395,6 +400,11 @@ OC.Settings.Apps = OC.Settings.Apps || { }, uninstallApp:function(appId, element) { + if (OC.PasswordConfirmation.requiresPasswordConfirmation()) { + OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.uninstallApp, this, appId, element)); + return; + } + OC.Settings.Apps.hideErrorMessage(appId); element.val(t('settings','Uninstalling ....')); $.post(OC.filePath('settings','ajax','uninstallapp.php'),{appid:appId},function(result) { -- cgit v1.2.3