- Issue created by @scott_euser
- Status changed to Needs review
5 months ago 5:42am 20 June 2024 - π¬π§United Kingdom scott_euser
Could use some suggestions on how to add tests for this (if its possible for the install)
- Status changed to Needs work
5 months ago 1:51pm 25 June 2024 - πΊπΈUnited States smustgrave
Appears to have relevant test failures.
Also MR should be updated for 11.x vs 11.0.x
- Status changed to Needs review
5 months ago 7:28am 26 June 2024 - π¬π§United Kingdom scott_euser
Okay I updated the approach to check for the existence of user 1 already.
I updated the issue summary with an explanation on how to simply reproduce this on any Drupal site via Drush (of course because its programmatically it then does not have the risk, but hopefully its helpful for testing and moving this issue forward).
The tests will continue to fail though because the problem is that the installation tests actually do as the issue here defines, with different causes.
- InstallerTestBase::setUp() calls parent ::setUp()
- parent ::setUp() calls ::installDrupal() which is overridden by InstallerTestBase and installs drupal
- InstallerTestBase::setUp() then runs checks that Drupal can be installed and the tests fail if not BUT Drupal is already installed because ::installDrupal() is run.
So really its testing that Drupal can be reinstalled when its already installed which actually seems like it might not be correct?
I did add a test which shows with a simple state change, the installer can be re-run without the code change (which eventually leads to user 1 getting overridden).
Given this is going to affect so many tests (36 tests) because of the above, I wonder if the simpler thing to do is just to allow a $setting variable like $settings['disable_installer'] = TRUE; and if that would be easier to get in. Essentially I do not want to put lots of effort into something that will likely never get merged.
Ultimately I want to be able to prevent existing sites from getting user 1 overridden as to me that's a high risk issue, so being able to disable the installer would similarly achieve that. I can of course manually set the state to done to avoid the issue but a future failure can cause the state to change back as its possible that state is wiped in which case the installer goes through the steps again and if it has e.g. import translation failures, it will not consider that step done.
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Clarifying that this was logged privately to the security team who approved for it to be public
- Status changed to Needs work
4 months ago 3:00pm 11 August 2024 - πΊπΈUnited States smustgrave
So definitely seems like something to fix. Posted about it in #needs-review-queue-initiative and as @larowlan mentioned was originally security issue made public.
Before adding $settings['disable_installer'] = TRUE is there any benefit to having this as FALSE? If there are scenarios then I think the setting makes sense but if something that should always be TRUE maybe we just don't allow it?