Skip to content

Commit

Permalink
Add missing taint analysis docblock comments, and improve escaping in…
Browse files Browse the repository at this point in the history
… some methods

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
CarlSchwan authored and come-nc committed Apr 24, 2023
1 parent e8a48b5 commit de92baf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/dashboard/lib/Controller/LayoutApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use OCP\IRequest;

class LayoutApiController extends OCSController {

/** @var IConfig */
private $config;
/** @var string */
Expand All @@ -56,6 +55,7 @@ public function __construct(
* @return JSONResponse
*/
public function create(string $layout): JSONResponse {
$layout = htmlspecialchars($layout);
$this->config->setUserValue($this->userId, 'dashboard', 'layout', $layout);
return new JSONResponse(['layout' => $layout]);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,9 @@ public function update($id, array $data) {
}

/**
* extract query parts and params array from data array
* Extract query parts and params array from data array
*
* @psalm-taint-escape sql
* @param array $data
* @return array
*/
Expand Down
1 change: 1 addition & 0 deletions lib/private/Files/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ public static function hasUpdated($path, $time) {
* @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) {
Expand Down
4 changes: 3 additions & 1 deletion lib/private/legacy/OC_App.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit de92baf

Please sign in to comment.