]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add missing taint analysis docblock comments, and improve escaping in some methods 36378/head
authorCarl Schwan <carl@carlschwan.eu>
Wed, 31 Aug 2022 19:15:02 +0000 (21:15 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Mon, 24 Apr 2023 15:17:53 +0000 (17:17 +0200)
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/dashboard/lib/Controller/LayoutApiController.php
lib/private/Files/Filesystem.php
lib/private/legacy/OC_App.php

index 755470b7b07eaaf92da50b2c9c4faffdaac4c6d9..8eb01be497eac321a0016baf74f4a7ad1b225866 100644 (file)
@@ -31,7 +31,6 @@ use OCP\IConfig;
 use OCP\IRequest;
 
 class LayoutApiController extends OCSController {
-
        /** @var IConfig */
        private $config;
        /** @var string */
@@ -56,6 +55,7 @@ class LayoutApiController extends OCSController {
         * @return JSONResponse
         */
        public function create(string $layout): JSONResponse {
+               $layout = htmlspecialchars($layout);
                $this->config->setUserValue($this->userId, 'dashboard', 'layout', $layout);
                return new JSONResponse(['layout' => $layout]);
        }
index 367982eed72d82a888a1f6a26044a6445956e12f..c50fa1f9de98f447fa5b01e93dc98c1c001d3795 100644 (file)
@@ -642,6 +642,7 @@ class Filesystem {
         * @param bool $stripTrailingSlash whether to strip the trailing slash
         * @param bool $isAbsolutePath whether the given path is absolute
         * @param bool $keepUnicode true to disable unicode normalization
+        * @psalm-taint-escape file
         * @return string
         */
        public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false, $keepUnicode = false) {
index b28b2d38fbdc1c343017323d14834ec76e9c0290..b1da6a1d2fbea8d41d704a3ae05a5af0be3fe1ed 100644 (file)
@@ -85,12 +85,14 @@ class OC_App {
         *
         * @psalm-taint-escape file
         * @psalm-taint-escape include
+        * @psalm-taint-escape html
+        * @psalm-taint-escape has_quotes
         *
         * @param string $app AppId that needs to be cleaned
         * @return string
         */
        public static function cleanAppId(string $app): string {
-               return str_replace(['\0', '/', '\\', '..'], '', $app);
+               return str_replace(['<', '>', '"', "'", '\0', '/', '\\', '..'], '', $app);
        }
 
        /**