Review main Merged

81793[BUGFIX] Create same configuration in web and cli install process

Helmut Hummel CR +2 V +2 Normal +115 −130 updated 09/06/24, 08:36

Commit message

The code for the web installer and the cli installer
is only partly aligned and shared, thus may easily
diverge, leading to different installation results.

The code to create system settings is now put
into SetupService and is used for both installation
methods, so that the cli install now also uses
FactoryConfiguration.php.

Additionally, the following cleanups are performed
to prepare further cleanup of the installation process:

* The cli setup does not set insecure trustedHostPattern any more.
* Silent config and template file changes are removed from setup,
  as conceptually these do nothing on newly created config and
  template files.
* New exceptions are created for config file generation instead
  of misusing a FAL-related exception.
* Absolute paths are made relative to project path before being
  passed to exception.

Review

  • Code review CR +2 Done
    • Helmut Hummel +2
    • Benjamin Franzke +1
    • Stefan Bürk +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Helmut Hummel +2
    • Benjamin Franzke +1
    • Stefan Bürk +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 1

Files 8

Review log 3951

Show 1826 earlier messages
  1. Helmut Hummel uploaded patch set 1 11/19/23, 17:27

  2. core-ci voted on patch set 1 V +1 11/19/23, 17:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49099

  3. Simon Schaufelberger commented on patch set 1 11/22/23, 12:49

    double "in"
  4. Thomas Hohn commented on patch set 1 CR +1 11/22/23, 13:34

    Looks fine to me except for the in in issue ;-)
  5. Simon Schaufelberger updated the commit message in patch set 2 CR +1 V +1 11/23/23, 11:23

  6. Simon Schaufelberger commented on patch set 2 CR +1 V +1 11/23/23, 11:23

    Reply

    Done
  7. core-ci voted on patch set 2 V +1 11/23/23, 11:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49644

  8. Simon Schaufelberger rebased onto patch set 3 CR +1 V +1 01/06/24, 22:28

  9. core-ci voted on patch set 3 V +1 01/06/24, 22:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51175

  10. Helmut Hummel uploaded patch set 4 V +1 02/26/24, 11:02

  11. core-ci voted on patch set 4 V +1 02/26/24, 11:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53595

  12. Stefan Bürk uploaded patch set 5 V +1 03/04/24, 16:08

  13. Stefan Bürk voted on patch set 5 CR +1 V +1 03/04/24, 16:09

  14. core-ci voted on patch set 5 V +1 03/04/24, 16:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53878

  15. Thomas Hohn voted on patch set 5 CR +1 03/05/24, 13:32

  16. Andreas Kienast uploaded patch set 6 CR +1 V +1 03/14/24, 07:55

  17. Andreas Kienast commented on patch set 6 03/14/24, 07:55

    I've rebased the patch only.
  18. core-ci voted on patch set 6 V +1 03/14/24, 08:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54516

  19. Benjamin Franzke commented on patch set 6 03/16/24, 11:13

    Very good catch. This should have never been merged with `.*.*` set by default (looks like it was probably just a left-over and hopefully not really intended as a "sane" default[1]). I wonder how to proceed here. All installations created with with `.*.*` defined in LocalConfiguration.php should be warned. I'm thinking about adding this value to the list of insecure values in `SecurityStatus::getTrustedHostsPatternStatus`. That would probably make ddev users unhappy. But well, I personally still kinda like to do that to force ddev to fix it's broken webserver setups, as it is really the root cause of this misusage of trustedHostPattern. [1] https://review.typo3.org/c/Packages/TYPO3.CMS/+/76860/5/typo3/sysext/install/Classes/Service/SetupService.php#156

    DefaultFactory.php:167

    change to "exists in composer mode only for" (otherwise it sounds as if it only exists in composer mode, but not in classic mode)
  20. Simon Schaufelberger uploaded patch set 7 V +1 04/21/24, 20:26

  21. core-ci voted on patch set 7 V +1 04/21/24, 20:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56441

  22. Helmut Hummel uploaded patch set 8 V +1 04/21/24, 20:43

  23. Helmut Hummel commented on patch set 7 04/21/24, 20:43

    DefaultFactory.php:167 Reply

    Done
  24. Helmut Hummel commented on patch set 8 04/21/24, 20:47

    Reply

    Yes this value is worse, as SecurityStatus does not even warn, but I don't like this being present in the installer either: https://github.com/TYPO3/typo3/blob/74ea84e22656f787e135f1e1bb50a5fef037867d/typo3/sysext/install/Classes/Controller/InstallerController.php#L225-L236 But that is another story. > I'm thinking about adding this value to the list of insecure values in Maybe performing a check against a randomly generated hostname could make sense to cover other variants of "allow all" regexes..
  25. core-ci voted on patch set 8 V +1 04/21/24, 20:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56442

  26. Helmut Hummel uploaded patch set 9 V +1 06/15/24, 20:46

  1. core-ci voted on patch set 9 V +1 06/15/24, 20:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59654

  2. Markus Klein updated the commit message in patch set 10 V +1 06/15/24, 21:13

  3. core-ci voted on patch set 10 V +1 06/15/24, 21:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59657

  4. Simon Schaufelberger voted on patch set 10 CR +1 06/16/24, 08:11

  5. Helmut Hummel uploaded patch set 11 CR +1 V +1 09/03/24, 14:43

  6. Helmut Hummel commented on patch set 11 09/03/24, 14:44

    Reply

    Can and should be done in a separate change
  7. core-ci voted on patch set 11 V -1 09/03/24, 14:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64673

  8. Benjamin Franzke commented on patch set 11 09/04/24, 06:33

    Reply

    ack
  9. core-ci voted on patch set 11 V +1 09/04/24, 06:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64673

  10. Benjamin Franzke commented on patch set 11 CR +1 V +1 09/04/24, 09:06

    Reply

    Just want to mention. I'm now running into: > The current host header value does not match the configured trusted hosts pattern! Check the pattern defined in $GLOBALS['TYPO3_CONF_VARS']['SYS'] with a bare ddev instance, without `system/additional.php` – but that is expected, as the `system/additional.php`, which sets the insecure `trustedHostsPattern` for ddev, is needed for web-installed TYPO3 as well.

    SetupService.php:349

    I know this has been used alot of trimes, but replacing paths in strings is always fragile, see https://review.typo3.org/c/Packages/TYPO3.CMS/+/81736 where `PublicPath` was used by accident (and is hard to "find" later). Therefore we decided to not just replace with `getProjectPath()`, but calculate the paths statically, without resolving them into an absolute filepath at all. Ideally `ConfigurationManager` would learn methods to provide static path names (cleary intended for user-facing messages). …but I can ignore that "for" now, as we have the same code in typo3/sysext/backend/Classes/Preview/FluidBasedContentPreviewRenderer.php
  11. Garvin Hicking commented on patch set 11 09/04/24, 09:37

    Reply

    (Minor note too: This can BTW be remedied if one executes the installer with http:// instead of https:// - with "bare" you probably mean "project_type=php"? With "project_type=typo3" you need to restart ddev after a composer install so that the DDEV recognition to create AdditionalConfiguration can take effect)
  12. Benjamin Franzke commented on patch set 11 09/04/24, 09:44

    Reply

    > with "bare" you probably mean "project_type=php"? yes
  13. Oliver Hader voted on patch set 11 CR +1 09/05/24, 09:56

  14. Garvin Hicking commented on patch set 11 09/05/24, 10:29

    I haven't checked this yet due to time constraints. Could the silentconfig upgrader be needed to actually migrate ddevs AdditionalConfiguration.php to additional.php, so it can take effect? Removing that call would mean ddevs trustedHostPattern approach would not work.
  15. Oliver Hader voted on patch set 11 V +1 09/05/24, 10:45

  16. Oliver Hader commented on patch set 11 09/05/24, 10:53

    Reply

    It looks(!) like this (writing/migrating `additional.php`) is handled by DDEV: https://github.com/ddev/ddev/blob/d7c0aff523c9b1a33abdb1de446887ebe04fe3c5/pkg/ddevapp/typo3.go#L132-L145
  17. Garvin Hicking commented on patch set 11 09/05/24, 10:56

    Reply

    This only works in composer based ddev typo3 installs, not legacy/for typo3 contributors, IIRC?
  18. Garvin Hicking commented on patch set 11 09/05/24, 11:13

    Reply

    (The matrix I wanted to test, but couldn't yet:) - CLI composer ddev type=typo3 - CLI composer ddev type=php - CLI legacy ddev type=typo3 - CLI legacy ddev type=php - CLI contrib-legacy ddev type=typo3 - WEB composer ddev type=typo3 - WEB composer ddev type=php - WEB legacy ddev type=typo3 - WEB legacy ddev type=php - WEB contrib-legacy ddev type=typo3 My feedback here shouldn't be blocking. Please resolve if you feel this is unhelpful.
  19. Stefan Bürk commented on patch set 11 09/05/24, 11:59

    Reply

    I guess we need to contribute monorepo handling to ddev to use the proper path/files so ddev handles this correctly. Relying on "silent migration" is not good here anyway. Beside that, silent configuration can still be triggered/executed by running the upgrade wizards command (which is also dirty in some way): ``` bin/typo3 upgrade:run ``` At least when using cli setup (which is also the recommended and documented way in the core contribution guide). Using the installer (web) the trustedHostPattern needs to be provided manually - or the "AdditionalConfiguration.php" copied manually before calling the web installer.

    SetupService.php:349 Reply

    Should at least be a construct to extract `getProjectPath()` from "left" only if $absolutePath starts with it. str_start_with() and substring() construct. We should have something like that (tested) in general somewhere in the core. Maybe also time to think about using symfony file/path tools (indirectly required yet).
  20. Stefan Bürk commented on patch set 11 09/05/24, 13:25

  21. Stefan Bürk voted on patch set 11 CR +1 V +1 09/05/24, 18:03

  22. Helmut Hummel commented on patch set 11 09/06/24, 08:35

    Reply

    Silent config upgrader is removed and now not executed any more on a clean install. This is unrelated to upgrades. Besides, the silent config upgrader does not handle additional config anyway
  23. Helmut Hummel voted on patch set 11 CR +2 V +2 09/06/24, 08:36

  24. Helmut Hummel merged patch set 12 09/06/24, 08:36

  25. Helmut Hummel commented on patch set 12 09/06/24, 08:36

    Thanks anyone for your reviews!