aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Config
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib/Config')
-rw-r--r--apps/files_external/lib/Config/ConfigAdapter.php19
-rw-r--r--apps/files_external/lib/Config/ExternalMountPoint.php1
-rw-r--r--apps/files_external/lib/Config/IConfigHandler.php1
-rw-r--r--apps/files_external/lib/Config/SimpleSubstitutionTrait.php1
-rw-r--r--apps/files_external/lib/Config/UserContext.php1
-rw-r--r--apps/files_external/lib/Config/UserPlaceholderHandler.php1
6 files changed, 20 insertions, 4 deletions
diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php
index c84fbb19102..a46c0fd5c66 100644
--- a/apps/files_external/lib/Config/ConfigAdapter.php
+++ b/apps/files_external/lib/Config/ConfigAdapter.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -40,6 +41,19 @@ class ConfigAdapter implements IMountProvider {
}
/**
+ * @param class-string $class
+ * @return class-string<IObjectStore>
+ * @throws \InvalidArgumentException
+ * @psalm-taint-escape callable
+ */
+ private function validateObjectStoreClassString(string $class): string {
+ if (!\is_subclass_of($class, IObjectStore::class)) {
+ throw new \InvalidArgumentException('Invalid object store');
+ }
+ return $class;
+ }
+
+ /**
* Process storage ready for mounting
*
* @throws QueryException
@@ -51,10 +65,7 @@ class ConfigAdapter implements IMountProvider {
$objectStore = $storage->getBackendOption('objectstore');
if ($objectStore) {
- $objectClass = $objectStore['class'];
- if (!is_subclass_of($objectClass, IObjectStore::class)) {
- throw new \InvalidArgumentException('Invalid object store');
- }
+ $objectClass = $this->validateObjectStoreClassString($objectStore['class']);
$storage->setBackendOption('objectstore', new $objectClass($objectStore));
}
diff --git a/apps/files_external/lib/Config/ExternalMountPoint.php b/apps/files_external/lib/Config/ExternalMountPoint.php
index 0dc2eab5120..97569ed2913 100644
--- a/apps/files_external/lib/Config/ExternalMountPoint.php
+++ b/apps/files_external/lib/Config/ExternalMountPoint.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Config/IConfigHandler.php b/apps/files_external/lib/Config/IConfigHandler.php
index 2f1604e232b..9e8283cc58b 100644
--- a/apps/files_external/lib/Config/IConfigHandler.php
+++ b/apps/files_external/lib/Config/IConfigHandler.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Config/SimpleSubstitutionTrait.php b/apps/files_external/lib/Config/SimpleSubstitutionTrait.php
index 21269d7526e..85a76054fa8 100644
--- a/apps/files_external/lib/Config/SimpleSubstitutionTrait.php
+++ b/apps/files_external/lib/Config/SimpleSubstitutionTrait.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Config/UserContext.php b/apps/files_external/lib/Config/UserContext.php
index 6fe679c60b2..fb5c79a9329 100644
--- a/apps/files_external/lib/Config/UserContext.php
+++ b/apps/files_external/lib/Config/UserContext.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Config/UserPlaceholderHandler.php b/apps/files_external/lib/Config/UserPlaceholderHandler.php
index ec91df5fb7a..d158e6923c1 100644
--- a/apps/files_external/lib/Config/UserPlaceholderHandler.php
+++ b/apps/files_external/lib/Config/UserPlaceholderHandler.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later