diff options
author | Alex Pott <alex.a.pott@googlemail.com> | 2025-04-16 10:59:24 +0200 |
---|---|---|
committer | Alex Pott <alex.a.pott@googlemail.com> | 2025-04-16 13:09:17 +0200 |
commit | 68b8b571030aff9e81c73f7d0be38c6986d87df7 (patch) | |
tree | 95e787a724b1d7133a54de648448fa996c83a119 /core/modules | |
parent | a902834ced186897d62fc3a0af4c60dc7ec4de80 (diff) | |
download | drupal-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')
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 = [ |