Review main Merged

90099[FEATURE] Allow to utilize password validators in Install Tool

Garvin Hicking CR +2 V +2 Hard +306 −14 updated 01/14/26, 10:17

Commit message

The `install:password:set` CLI command did not yet evaluate password
strength of the Install Tool.

Additionally, the Install Tool GUI itself only enforced a
minimum length of 8 characters and did not evaluate possible
PasswordPolicyValidators at all.

This patch aligns this with these changes:

*  The GUI Install Tool will now utilize a set of default
   password policy validators.

*  The CLI command will utilize the same set of validators.

*  The automatic password generation can specify password
   length.

Currently, setting up the password policy validation was strictly
aimed at FE and BE user context. A new "installTool" set
has now been added to
`$GLOBALS['TYPO3_CONF_VARS']['SYS']['passwordPolicies']['installTool']['validators']`.

Alongside, a new PasswordService class has been added to easily
instantiate validators with a unique entry point. This class can
be utilized in the future by other places that currently do the same
boilerplate initialization.

The CLI command is now also able to check whether the password is
set via "additional.php" and bail out in such a case. Also a note
that additional.php overrides will take precedence is added.

The message on the Install Tool login screen is enhanced by
also mentioning the existing CLI command.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Guido Schmechel +1
    • Lina Wolf +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Guido Schmechel +1
    • Lina Wolf +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 3

Files 13

Review log 5981

Show 3756 earlier messages
  1. Garvin Hicking uploaded patch set 1 07/18/25, 22:26

  2. Garvin Hicking updated the commit message in patch set 2 07/18/25, 22:31

  3. core-ci voted on patch set 1 V -1 07/18/25, 22:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81940

  4. core-ci voted on patch set 2 V -1 07/18/25, 22:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81941

  5. Garvin Hicking updated the commit message in patch set 3 V -1 07/19/25, 09:10

  6. core-ci voted on patch set 3 V -1 07/19/25, 09:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81957

  7. Rozbeh Chiryai Sharahi uploaded patch set 4 V -1 07/19/25, 09:27

  8. core-ci voted on patch set 4 V +1 07/19/25, 09:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81958

  9. Rozbeh Chiryai Sharahi uploaded patch set 5 V +1 07/19/25, 10:39

  10. core-ci voted on patch set 5 V -1 07/19/25, 10:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81959

  11. Rozbeh Chiryai Sharahi uploaded patch set 6 V -1 07/19/25, 10:58

  12. core-ci voted on patch set 6 V -1 07/19/25, 11:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81960

  13. Garvin Hicking uploaded patch set 7 V -1 07/21/25, 08:54

  14. core-ci voted on patch set 7 V -1 07/21/25, 09:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82034

  15. Garvin Hicking uploaded patch set 8 V -1 07/21/25, 09:36

  16. Garvin Hicking uploaded patch set 9 07/21/25, 09:39

  17. core-ci voted on patch set 8 V -1 07/21/25, 09:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82042

  18. core-ci voted on patch set 9 V -1 07/21/25, 09:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82043

  19. Garvin Hicking commented on patch set 10 V -1 07/21/25, 11:26

    Published edit on patch set 9.
  20. Garvin Hicking commented on patch set 11 07/21/25, 11:27

    Published edit on patch set 10.
  21. Garvin Hicking commented on patch set 12 07/21/25, 11:29

    Published edit on patch set 11.
  22. core-ci voted on patch set 10 V -1 07/21/25, 11:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82059

  23. core-ci voted on patch set 11 V -1 07/21/25, 11:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82060

  24. core-ci voted on patch set 12 V -1 07/21/25, 11:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82061

  25. Garvin Hicking uploaded patch set 13 V -1 07/21/25, 12:46

  26. core-ci voted on patch set 13 V +1 07/21/25, 12:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82062

  27. Garvin Hicking uploaded patch set 14 V +1 07/21/25, 14:32

  28. core-ci voted on patch set 14 V +1 07/21/25, 14:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82067

  29. Torben Hansen commented on patch set 14 07/21/25, 17:29

    PasswordPolicyUsage.php:24

    I'm not sure, if we need this enum. Actually, the ` $GLOBALS['TYPO3_CONF_VARS']['SYS']['passwordPolicies']` contains password policies (defined as an array). I)t can for example contain a password policy for frontend and a different for backend users. Naming is totally free here (e.g. users may call ot `foo-password-policy`), so having a dedicated enum for just 2 usecases seems too much IMO. Additionally, the name of the class does not reflect the real scope of the used strings.
  30. Garvin Hicking commented on patch set 14 07/21/25, 17:50

    PasswordPolicyUsage.php:24 Reply

    My reasoning here was that "default" already is more of an identifier than a random string and I wanted to ensure certain "hardcoded" strings to be identifically and typed for the PasswordService class, also so that in the future we could distinguish between user-space entries and core-space entries. Do you maybe have a better classname? Naming things is hard. ;-)
  31. Garvin Hicking updated the commit message in patch set 15 V +1 07/26/25, 19:28

  32. core-ci voted on patch set 15 V +1 07/26/25, 19:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82363

  33. Rozbeh Chiryai Sharahi commented on patch set 15 CR +1 V +1 08/08/25, 09:46

    Tested settings password via cli and via install tool (logged-in and via /typo3/install.php) Also having a install-tool configured in additional.php causes an error and abort as intended by code.
  34. Rozbeh Chiryai Sharahi commented on patch set 15 CR 0 V 0 08/08/25, 09:53

    ShowLogin.html:60

    This should be bin/typo3 install:password:set
  35. Rozbeh Chiryai Sharahi uploaded patch set 16 V +1 08/08/25, 09:55

  36. Rozbeh Chiryai Sharahi commented on patch set 16 CR +1 V +1 08/08/25, 09:56

    ShowLogin.html:60 Reply

    Done
  37. core-ci voted on patch set 16 V +1 08/08/25, 10:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83006

  38. Rozbeh Chiryai Sharahi commented on patch set 16 CR 0 V 0 08/08/25, 10:04

    PasswordPolicyUsage.php:24 Reply

    I am fine with having an ENUM for those default keys, however ... If the password-policies array is supposed to be extendible to anything more than install, backend, frontend, the enum might cause a problem on PasswordService as the service has the enum as parameter type. In such case it would not be possible to use password-service for anything else than those enum cases.
  39. Rozbeh Chiryai Sharahi commented on patch set 16 08/08/25, 10:32

    PasswordPolicyUsage.php:24 Reply

    PasswordPolicy class currently uses the enum PasswordPolicyAction. I think in current state of the class PasswordPolicy any additional password-policy-usage is anyway hard to achieve, as it would most probably lead to the need of a new PasswordPolicyAction, unless you can by chance reuse one of those actions. Should we address that? One idea without big impact: Do not use enums as parameter types (for instance PasswordPolicy and PasswordService)
  40. Rozbeh Chiryai Sharahi uploaded patch set 17 V +1 08/08/25, 10:38

  41. core-ci voted on patch set 17 V +1 08/08/25, 10:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83007

  42. Elias Häußler commented on patch set 17 08/29/25, 07:49

    PasswordService.php:29

    Would it be useful to start using the `#[\SensitiveParameter]` attribute here (and in line 46 as well)?
  43. Garvin Hicking commented on patch set 17 08/29/25, 08:28

    PasswordService.php:29 Reply

    Good idea, need to look into this. Thanks!
  44. Stefan Froemken commented on patch set 18 V +1 08/29/25, 12:12

    Published edit on patch set 17.
  45. Stefan Froemken commented on patch set 18 08/29/25, 14:17

    PasswordService.php:43

    Remove "return" annotations if it has no additional information

    PasswordService.php:51

    PasswordPolicyValidator has state, but is not declared as shared:false. Should we add that or should we switch to "new" here?

    PasswordSetCommand.php:76

    Regardless of equal or non-equal passwords in these files: after setting the new password you still can not login into the InstallTool. That's why I prefer to move that check AFTER setting the new password and inform the user accordingly.

    Services.yaml:45

    Why? You don't load it via GeneralUtility
  46. Garvin Hicking uploaded patch set 19 09/10/25, 14:18

  47. Georg Ringer commented on patch set 19 09/10/25, 14:28

    Feature-90099-AllowToUtilizePasswordValidatorsInInstallTool.rst:53

    I would suggest to remove that "feature" and throw an exception if no validators are configured! It could be still possible to then adopt the minimumlength to e.g. 3 or so but this requires specific actions - removing all validators could happen easier by accident
  48. Garvin Hicking commented on patch set 19 09/10/25, 14:29

    PasswordPolicyUsage.php:24 Reply

    After some more rounds of sleep I think the ENUM also does introduce more trouble than it tries to solve, I've removed it from the implementation.

    PasswordService.php:29 Reply

    Done

    PasswordService.php:43 Reply

    Done

    PasswordService.php:51 Reply

    I would like to address this in a dedicated patch.

    PasswordSetCommand.php:76 Reply

    Hm, I think changing the password in a case where this is not effective is not good; it would create a non-effective change. Changing the password would need to be done in a different file, so this is a hard failure in my eyes.

    Services.yaml:45 Reply

    Done
  49. Garvin Hicking commented on patch set 19 09/10/25, 14:30

    Feature-90099-AllowToUtilizePasswordValidatorsInInstallTool.rst:53 Reply

    IMO it's a valid usecase in dev environments to remove the validators...
  50. core-ci voted on patch set 19 V +1 09/10/25, 14:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84785

  51. Torben Hansen commented on patch set 19 09/11/25, 06:09

    Feature-90099-AllowToUtilizePasswordValidatorsInInstallTool.rst:53 Reply

    Yes, this is a valid use case and unsetting a password policy should have impact in all places, where password policies are used.
  52. Stefan Froemken commented on patch set 19 V -1 09/12/25, 07:17

    I have updated the installTool validators to my needs. 24 chars minimum. If I now use the CLI to set a new auto-generated password, the command will fail, as auto-generation will not use the validator settings to provide a new password: ➜ typo3_git git:(main) ddev typo3 install:password:set Password (leave empty for auto generation): Generated password: ;l4{F91?S4=3J\i- Your password could not be used. The following validation rules did not pass: - The password is too short. Minimum length is 24 chars (corePasswordValidator.minimumLength) Failed to run typo3 install:password:set: exit status 1

    PasswordService.php:33

    Why does php-cs-fixer does not complain about the missing comma here anymore?!
  53. Garvin Hicking commented on patch set 20 V +1 09/12/25, 07:51

    Published edit on patch set 19.
  54. Garvin Hicking commented on patch set 20 09/12/25, 07:52

    Reply

    Hm that is a conceptual problem of course. A validator only validates, but does not generate. So we have no idea of what a validator might check and how to generate something that matches. We could do that for the core validator with the "minimumlength" option though. Would that be sufficient? I think auto generation still has its use, and at least the command says that it fails like that.... Do you have suggestions maybe?

    PasswordService.php:33 Reply

    I think it only enforces it for array keys and not method parameters. I'll update this though, thanks.
  55. Garvin Hicking commented on patch set 20 09/12/25, 07:54

    Reply

    Hm, additional configured validators might override the minimum length, so that would also be half-complete. Maybe we should better allow a config directive to set the length of the generated password?!
  56. core-ci voted on patch set 20 V +1 09/12/25, 08:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84887

  1. Stefan Froemken commented on patch set 20 09/12/25, 14:31

    Reply

    You're right, the password length should **not** be read from validator configuration. The validators are part of user entered passwords and not part of auto-generated passwords. The validator options should never be part of the auto-generated password. It should never happen that someone disables an option and we deliver insecure passwords for installtool. And, if we allow configuring the length, it still should never be less than TYPO3 default of 16 chars. Ideas: * Deactivate validators for auto-generated passwords * Add a console srgument to set the length of auto-generated passwords (> 16 chars). Needs Feature RST * Add a new option in passwordPolicies to set the length of auto-generated passwords (> 16 chars). Needs Feature RST
  2. Garvin Hicking commented on patch set 20 09/12/25, 15:04

    Reply

    Your list sounds good to me, I'll try to find time to implement this here! Thank you!
  3. Garvin Hicking uploaded patch set 21 V +1 12/12/25, 10:31

  4. Garvin Hicking commented on patch set 21 12/12/25, 10:32

    Reply

    I've now adjusted this. A new "--pasword-length" argument is now available for this to affect password generator autocreation.

    Feature-90099-AllowToUtilizePasswordValidatorsInInstallTool.rst:53 Reply

    Done
  5. core-ci voted on patch set 21 V +1 12/12/25, 10:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92127

  6. Lina Wolf commented on patch set 21 CR +1 V +1 12/12/25, 11:55

    Tested both the console command and the install tool function. In the install tool, the error messages are hard to see but this is not related to this change
  7. Guido Schmechel commented on patch set 21 12/12/25, 18:44

    Just a minor detail. But basically everything worked out for me and the +1 will follow in the next run :-)
    validation
  8. Garvin Hicking updated the commit message in patch set 22 CR +1 V +1 12/12/25, 18:55

  9. core-ci voted on patch set 22 V +1 12/12/25, 19:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92163

  10. Guido Schmechel voted on patch set 22 CR +1 V +1 12/12/25, 19:18

  11. Lina Wolf voted on patch set 22 CR +1 V +1 12/13/25, 02:08

  12. Garvin Hicking commented on patch set 22 12/14/25, 18:32

    Reply

    Done
  13. Rozbeh Chiryai Sharahi voted on patch set 22 CR +1 01/10/26, 10:46

  14. Simon Schaufelberger commented on patch set 22 01/10/26, 16:35

    PasswordSetCommand.php:40

    why suddenly protected? This is a final class and can't be extended.
  15. Garvin Hicking commented on patch set 22 01/10/26, 17:39

    PasswordSetCommand.php:40 Reply

    I think this is due to the merge automatics after the protected>private patch spree was merged. A bit odd though, I'd have expected a merge conflict then. Meh. Guess I have to lose all votes now 😭
  16. Garvin Hicking uploaded patch set 23 CR +1 V +1 01/10/26, 17:56

    adjuts private vs protected
  17. Garvin Hicking commented on patch set 23 01/10/26, 17:57

    PasswordSetCommand.php:40 Reply

    Done
  18. core-ci voted on patch set 23 V +1 01/10/26, 18:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93214

  19. Simon Schaufelberger voted on patch set 23 CR +1 V +1 01/10/26, 19:06

  20. Guido Schmechel voted on patch set 23 CR +1 V +1 01/10/26, 20:34

  21. Georg Ringer voted on patch set 23 CR +1 V +1 01/12/26, 22:36

  22. Lina Wolf voted on patch set 23 CR +1 V +1 01/14/26, 09:19

  23. Elias Häußler wrote 01/14/26, 09:28

    Removed cc Elias Häußler.
  24. Garvin Hicking voted on patch set 23 CR +2 V +2 01/14/26, 10:17

  25. Garvin Hicking merged patch set 24 01/14/26, 10:17