Problem/Motivation
The migration of system.file
settings migration (d6_system_file
and d7_system_file
) assumes that allow_insecure_uploads
variable is always set. I checked the most recent Drupal 7 codebase and although I may be wrong, it cannot be set with core UI. file_save_upload()
and file_munge_filename()
are only reading this variable.
This is a follow up to #2500533: Upgrade path for System 7.x
Proposed resolution
Do not return a source row if the D7 database does not have a allow_insecure_uploads
key-value pair in the variable
table.
The consequence will be that nothing gets migrated, since there is nothing to migrate.
Which means that the D8|9 default will continue to be used (which is FALSE
by default, and this is important for security.)
Remaining tasks
Add a test
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#38 | Screenshot 2023-03-16 at 8.51.18 AM.png | 165.88 KB | rohan-sinha |
#38 | Screenshot 2023-03-16 at 8.51.07 AM.png | 166.75 KB | rohan-sinha |
#22 | 3151979-22.patch | 454 bytes | Wim Leers |
#22 | interdiff.txt | 569 bytes | Wim Leers |
#10 | core-migrate_system_file_settings-3151979-10.patch | 445 bytes | huzooka |
Comments
Comment #2
huzookaComment #3
huzookaComment #4
quietone CreditAttribution: quietone as a volunteer commentedIf allow_insecure_uploads is not set the migration will skip the row.
Sorry, meant to add that the skip will happen in StaticMap.
Comment #6
Wim LeersBut a "skipped row" signals there is a row to migrate … even if there literally is nothing to migrate.
If I as an end user see "skipped row", then I think that there's something to migrate, and it was skipped … for an obscure reason:
That message very much sounds like an error/failure, not like a "oh, there's nothing to do here".
If there's nothing to do, I expect to see nothing.
Comment #7
huzookaI think I have an alternative solution even for this issue and for #3151980: System mail settings migration (d7_system_mail) assumes that the mail_system variable is always available and #3151993: Search settings migration (d7_search_settings) assumes that the search_default_module variable is always set that solves these for me (no errors anymore) and also fits @quietone's strategy.
Comment #8
huzookaSee #3152789-2: Add required variables config to Variable migrate source plugin, and if one of those are missing, return zero rows.
Comment #9
huzookaComment #10
huzookaComment #12
huzookaComment #14
Wim Leers#3152789: Add required variables config to Variable migrate source plugin, and if one of those are missing, return zero rows landed a month ago — no blockers left for this! Been using this for months and it works great 👍
Comment #16
ravi.shankar CreditAttribution: ravi.shankar at OpenSense Labs commentedBack to RTBC as per comment #14.
Comment #17
alexpottIt's vital that the default value of
allow_insecure_uploads
is FALSE. The issue summary states that it is TRUE. It took me a bit of time reading #3152789: Add required variables config to Variable migrate source plugin, and if one of those are missing, return zero rows since that is what we are using here. I'm not that keen on the namevariables_required
because:Anyway that's a separate issue. This works as advertised and if the variable is missing but we do need an issue summary update that details the actual solution and the correct default value.
Comment #18
quietone CreditAttribution: quietone as a volunteer commentedAdding tag for the IS updated asked for in #17. Setting to NW for that.
Comment #19
quietone CreditAttribution: quietone as a volunteer commentedReally set to NW
Comment #20
alexpottI opened #3182891: The variables_required setting is a tricky name to discuss the naming of variables_required.
Comment #21
Wim Leers#3182891: The variables_required setting is a tricky name just landed!
Comment #22
Wim LeersRerolled for #3182891: The variables_required setting is a tricky name.
Comment #23
benjifisherThis issue still needs an issue summary update, as stated in #17-#19.
If you update the summary, then I will review the issue (unless @quietone beats me to it).
Comment #24
benjifisherI think this title is clearer. Please revert the change if I misunderstand.
Comment #26
Wim LeersThe proposed solution simply predates #3182891: The variables_required setting is a tricky name, which is why it was so confusing! 😅
Issue summary updated :)
Comment #27
alexpott@Wim Leers atm if the d7 or d6 site is missing this variable what happens? Do they can a migration which sets allow_insecure_uploads to TRUE. If that's true then we need a text to prove this is fixed and this is way more important than a minor.
Comment #28
Wim Leers#27: Very good point. It's scary that there is not already a test for this, but now is the best time ever to add it if it does not already exist 😊👍
\Drupal\Tests\system\Kernel\Migrate\d7\MigrateSystemConfigurationTest
is the existing test. It was added in [#2500533. But that is indeed testing withWe need a test where that variable does not exist in the Drupal 7 DB.
Comment #29
Wim LeersComment #32
smustgrave CreditAttribution: smustgrave at Mobomo commentedQuestion on the testing. Seems the testing mentioned in #28 moved to the aggregator module that sound right? And is the test to check if allow_insecure_uploads is not set?
Comment #34
quietone CreditAttribution: quietone at PreviousNext commentedI disagree. When the variable is not set the value on the row is NULL and, in this case, the static map plugin throws a MigrateSkipRowException. The row is not migrated and the destination is not changed.
Drush shows this as 'ignored'.
In #6 this is considered a problem because the user thinks there is a row to migrate, when there wasn't.
I then applied that patch, rebuilt cache and re-ran the migration.
The user no longer has an ignored row. That seems to be the desired result, a change in what the user sees. I do not see that as a bug. Currently, the migration will migrate the source value when the variable is set and will do nothing when the variable is not set. With the patch the migration will do the same thing.
This is tagged for tests. I do not think that is necessary because we would only be testing that the Variable source plugin is not returning a row. And that is already tested.
For myself, I do not see the need for this change (unless I am missing something). But what I don't like is that this would change the messages of the 2 system_file migrations. And, worse, it would make these 2 migrations behave different from the other 47 migrations that are using the Variable source plugin.
Comment #35
smustgrave CreditAttribution: smustgrave at Mobomo commentedSeems to be back n forth if this is needed or should be done. Before reviewing is this something that could be finalized?
Comment #36
quietone CreditAttribution: quietone at PreviousNext commentedI think this needs the opinion of another migration maintainer, changing status and adding tag.
Comment #37
quietone CreditAttribution: quietone at PreviousNext commentedComment #38
rohan-sinha CreditAttribution: rohan-sinha at Srijan | A Material+ Company commentedi checked the senerios and studied the older issue with patch, looks that it is already done in d6 and d7 file system, coming back to the " When the variable is not set the value on the row is NULL and, in this case, the static map plugin throws a MigrateSkipRowException " please elaborate more so I can work on this issue, thanks.
Comment #39
benjifisherThe issue summary suggests that the proposed change affects the result of the migration. In fact, it only affects the messages from the migration. See #34 for detailed manual testing.
In #17, #18, and #23 we asked for an update to the issue summary to clarify this, and in #24 I changed the title for the same reason.
The summary was updated in #26, but only the "Proposed resolution" section. The "Problem/Motivation" still suggests that there is a problem with the result of the migration.
In short, it has been about 2.5 years and no one has taken the trouble to explain the point of this change in the issue summary. This issue is more of a distraction than it is worth, so I am closing it. Given the issue summary, I think that "works as designed" is appropriate.
Comment #40
benjifisherI repeated some of the manual testing from #34, to confirm the "works as designed" resolution. I installed fresh Drupal 7 and Drupal 10 sites (using the latest 7.x and 10.1.x branches). I enabled the
migrate_drupal_ui
module and configured it, starting at/upgrade
.I did not test the proposed patch.
Here is what I got: