diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-01-12 13:20:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-12 13:20:26 +0100 |
commit | 90c0e943dd15239def4b5d35ad7e417afe49e65b (patch) | |
tree | 9c6b9cb7b0109caaabdecb87dda83adae5a466dd | |
parent | b89e6f50e4e27bf0b4126eaa0b3ee039fd26f2c2 (diff) | |
parent | ac88bcbd5f03419e149dac2a080f8f206876547e (diff) | |
download | nextcloud-server-90c0e943dd15239def4b5d35ad7e417afe49e65b.tar.gz nextcloud-server-90c0e943dd15239def4b5d35ad7e417afe49e65b.zip |
Merge pull request #24606 from hosting-de/feature/allow-symlinks-configurable
Add 'allow Symlinks' as an option to config.php
-rw-r--r-- | config/config.sample.php | 9 | ||||
-rw-r--r-- | lib/private/Files/Storage/Local.php | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index 1560fe8ac39..216a32c8ebd 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1620,6 +1620,15 @@ $CONFIG = [ 'minimum.supported.desktop.version' => '2.0.0', /** + * Option to allow local storage to contain symlinks. + * WARNING: Not recommended. This would make it possible for Nextcloud to access + * files outside the data directory and could be considered a security risk. + * + * Defaults to ``false`` + */ +'localstorage.allowsymlinks' => false, + +/** * EXPERIMENTAL: option whether to include external storage in quota * calculation, defaults to false. * diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 5d0ce596b11..81d1d083eb8 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -58,8 +58,6 @@ class Local extends \OC\Files\Storage\Common { protected $dataDirLength; - protected $allowSymlinks = false; - protected $realDataDir; public function __construct($arguments) { @@ -441,7 +439,8 @@ class Local extends \OC\Files\Storage\Common { $fullPath = $this->datadir . $path; $currentPath = $path; - if ($this->allowSymlinks || $currentPath === '') { + $allowSymlinks = \OC::$server->getConfig()->getSystemValue('localstorage.allowsymlinks', false); + if ($allowSymlinks || $currentPath === '') { return $fullPath; } $pathToResolve = $fullPath; |