summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules
diff options
context:
space:
mode:
authorAlex Pott <alex.a.pott@googlemail.com>2025-04-16 10:59:24 +0200
committerAlex Pott <alex.a.pott@googlemail.com>2025-04-16 13:09:17 +0200
commit68b8b571030aff9e81c73f7d0be38c6986d87df7 (patch)
tree95e787a724b1d7133a54de648448fa996c83a119 /core/modules
parenta902834ced186897d62fc3a0af4c60dc7ec4de80 (diff)
downloaddrupal-68b8b571030aff9e81c73f7d0be38c6986d87df7.tar.gz
drupal-68b8b571030aff9e81c73f7d0be38c6986d87df7.zip
Issue #3436096 by yash.rode, bbrala, srishtiiee, naveenvalecha, smustgrave, alexpott, borisson_, wim leers, narendrar, catch: Add validation constraints to system.file
Diffstat (limited to 'core/modules')
-rw-r--r--core/modules/image/tests/src/Kernel/ImageStyleCustomStreamWrappersTest.php6
-rw-r--r--core/modules/system/config/schema/system.schema.yml9
-rw-r--r--core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php10
3 files changed, 24 insertions, 1 deletions
diff --git a/core/modules/image/tests/src/Kernel/ImageStyleCustomStreamWrappersTest.php b/core/modules/image/tests/src/Kernel/ImageStyleCustomStreamWrappersTest.php
index f9b6ab64180..88e25d8ee48 100644
--- a/core/modules/image/tests/src/Kernel/ImageStyleCustomStreamWrappersTest.php
+++ b/core/modules/image/tests/src/Kernel/ImageStyleCustomStreamWrappersTest.php
@@ -46,7 +46,11 @@ class ImageStyleCustomStreamWrappersTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->fileSystem = $this->container->get('file_system');
- $this->config('system.file')->set('default_scheme', 'public')->save();
+ $this->config('system.file')
+ ->set('default_scheme', 'public')
+ ->set('allow_insecure_uploads', FALSE)
+ ->set('temporary_maximum_age', 21600)
+ ->save();
$this->imageStyle = ImageStyle::create([
'name' => 'test',
'label' => 'Test',
diff --git a/core/modules/system/config/schema/system.schema.yml b/core/modules/system/config/schema/system.schema.yml
index 65ddbe0c32b..8d19b0dd2aa 100644
--- a/core/modules/system/config/schema/system.schema.yml
+++ b/core/modules/system/config/schema/system.schema.yml
@@ -334,6 +334,8 @@ system.action.*:
system.file:
type: config_object
label: 'File system'
+ constraints:
+ FullyValidatable: ~
mapping:
allow_insecure_uploads:
type: boolean
@@ -341,6 +343,10 @@ system.file:
default_scheme:
type: string
label: 'Default download method'
+ constraints:
+ ClassResolver:
+ classOrService: 'stream_wrapper_manager'
+ method: 'isValidScheme'
path:
type: mapping
label: 'Path settings'
@@ -348,6 +354,9 @@ system.file:
temporary_maximum_age:
type: integer
label: 'Maximum age for temporary files'
+ constraints:
+ Range:
+ min: 0
system.image:
type: config_object
diff --git a/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php b/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php
index 16fc7dfe338..ff5a8b02d45 100644
--- a/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php
+++ b/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php
@@ -14,6 +14,16 @@ use Drupal\KernelTests\KernelTestBase;
class UpdateDeleteFileIfStaleTest extends KernelTestBase {
/**
+ * Disable strict config schema checking.
+ *
+ * This test requires saving invalid configuration. This allows for the
+ * simulation of a temporary file becoming stale.
+ *
+ * @var bool
+ */
+ protected $strictConfigSchema = FALSE;
+
+ /**
* {@inheritdoc}
*/
protected static $modules = [