diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index ea5827808228837c49f4b034abb31fde53ab4a2e..b2c0fa62cf1e9d8a32eceba2499876615d9c8daf 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -680,6 +680,10 @@ class ShareAPIController extends OCSController {
 			throw new OCSNotFoundException($this->l->t('Wrong share ID, share doesn\'t exist'));
 		}
 
+		if ($share->getShareOwner() !== $this->currentUser && $share->getSharedBy() !== $this->currentUser) {
+			throw new OCSForbiddenException('You are not allowed to edit incomming shares');
+		}
+
 		if ($permissions === null && $password === null && $publicUpload === null && $expireDate === null) {
 			throw new OCSBadRequestException($this->l->t('Wrong or no update parameter given'));
 		}