From 715f89a9d9dc8373a85a23f93d093dee2686e232 Mon Sep 17 00:00:00 2001
From: Lukas Reschke <lukas@owncloud.com>
Date: Tue, 8 Dec 2015 10:01:09 +0100
Subject: [PATCH] Sanitize the appId passed to `findAppInDirectories`

Would have prevented quite some security bugs in the past. Nice hardening for now.
---
 lib/private/app.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/private/app.php b/lib/private/app.php
index 145517e218a..abf12264c58 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -474,9 +474,13 @@ class OC_App {
 	 * search for an app in all app-directories
 	 *
 	 * @param string $appId
-	 * @return mixed (bool|string)
+	 * @return false|string
 	 */
 	protected static function findAppInDirectories($appId) {
+		$sanitizedAppId = self::cleanAppId($appId);
+		if($sanitizedAppId !== $appId) {
+			return false;
+		}
 		static $app_dir = array();
 
 		if (isset($app_dir[$appId])) {
-- 
GitLab