- Issue created by @mcdruid
- π¬π§United Kingdom mcdruid π¬π§πͺπΊ
Looks like it's legitimate to have subdirectories within the tarball, based on
\Drupal\Tests\config\Functional\ConfigExportImportUITest::testExportImportCollections
.I'd initially assumed there was only ever a flat list of yml files.
- π¬π§United Kingdom mcdruid π¬π§πͺπΊ
Existing tests pass with the changes in the MR.
We should add one or more tests that show:
- Only .yml files are extracted from the tarball.
- A file with executable permissions in the tarball is extracted with default (664) permissions into the sync directory.
- π¬π§United Kingdom mcdruid π¬π§πͺπΊ
Added a basic test that verifies a shell script cannot be smuggled into a config import tarball, and checks that files are not executable after imports (even when they are inside the tarball).
I think this needs to be a functional test, as the changes being made are in the processing of the import form on submission.
- π¬π§United Kingdom mcdruid π¬π§πͺπΊ
Here's the contents of the test tarball:
core/modules/config/tests/fixtures$ tar ztvf not_just_config.tar.gz -rw-rw-r-- mcdruid/mcdruid 48 2025-06-26 10:50 config.one.yml -rw-rw-r-- mcdruid/mcdruid 48 2025-06-26 10:50 config.two.yml -rwxrwxr-x mcdruid/mcdruid 48 2025-06-26 11:03 executable.yml -rwxrwxr-x mcdruid/mcdruid 60 2025-06-26 10:52 script.sh
I was wondering about putting that in a comment in the test to save anyone having to examine it themselves.. but perhaps that just risks getting out of sync with the fixture file, and might not be necessary / helpful anyway.
- π¬π§United Kingdom mcdruid π¬π§πͺπΊ
Verified that the test-only job fails as expected:
https://git.drupalcode.org/issue/drupal-3526769/-/jobs/5685661
..but tests pass with the changes.
- πΊπΈUnited States smustgrave
I don't think we need to present error messages when there are files in the tarball that will not be extracted, or permissions that will be sanitised?
I would agree, not sure how many users import this way but imagine they are aware of the other files if they use this approach.
Looks like it's legitimate to have subdirectories within the tarball, based on \Drupal\Tests\config\Functional\ConfigExportImportUITest::testExportImportCollections.
Maybe translations?
Test-only feature has already been ran
1) Drupal\Tests\config\Functional\ConfigImportUploadTest::testImportTarballFiltering Failed asserting that true is false. /builds/issue/drupal-3526769/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php:89 FAILURES! Tests: 2, Assertions: 21, Failures: 1. Exiting with EXIT_CODE=1
Which seems to fail at a valid assertion for this issue.
Changes themselves look fine to me (least no objection)