Review main Merged

90065[FEATURE] Add password hashing option to SaveToDatabase finisher

Josua Vogel CR +2 V +2 Normal +118 −0 updated 07/18/25, 14:36

Commit message

This change introduces a new hashed option for the
SaveToDatabase finisher in EXT:form. When saving data to a table,
setting `hashed: true` on a field causes the value to be hashed
using the default FE password hashing mechanism before storage.

This ensures secure handling of passwords and avoids saving them
in plain text.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Sven Liebert +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Sven Liebert +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 5

Review log 2125

  1. Josua Vogel uploaded patch set 1 07/14/25, 18:04

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

  3. Josua Vogel uploaded patch set 2 V -1 07/14/25, 18:16

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

  5. Garvin Hicking commented on patch set 2 07/14/25, 18:47

    Could you also imeplement this to: * typo3/sysext/form/Documentation/D/FinisherOptions/Index.rst -> L843 ff * typo3/sysext/form/Documentation/I/Config/proto/finishersDefinition/finishers/SaveToDatabase.rst -> L228 ff
  6. Josua Vogel uploaded patch set 3 V +1 07/15/25, 05:58

  7. Josua Vogel commented on patch set 3 07/15/25, 05:59

    Reply

    Done
  8. core-ci voted on patch set 3 V +1 07/15/25, 06:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81720

  9. Mathias Brodala commented on patch set 3 CR -1 07/15/25, 06:08

    I'd rather introduce a dedicated finisher which takes an arbitrary value (runtime reference) and provides a finisher variable. This can then be used in any other finisher including the SaveToDatabase finisher. We should stick to KISS and not start packing too much stuff in the existing finishers.
  10. Josua Vogel commented on patch set 3 07/15/25, 06:25

    Reply

    Wouldn't that make an integrator's life more difficult? He has to add another finisher before the SaveToDatabase finisher so that he can save a password securely. The SaveToDatabase finisher already offers modifications for file references and date - in my opinion, another option for hashing doesn't break the camel's back and makes things easier for the integrator.
  11. Sven Liebert commented on patch set 3 07/15/25, 06:36

    Reply

    I would say that is against KISS to chain the finishers here. Because in my opinion than it's not foolproof anymore.
  12. Mathias Brodala commented on patch set 3 07/15/25, 06:42

    Reply

    If that's the goal then we'd need a single finisher for everything. ;-) Also think about future changes. Now we'd have "hashed: true", the next one wants "lowercased: true", "rot13: true", etc. This is a never ending story. IMO composition is better suited here.
  13. Josua Vogel commented on patch set 3 07/15/25, 06:56

    Reply

    From that perspective, you're right. I thought we were taking our cues from TCA options to reuse familiar patterns. There is hashed as a boolean option and your examples would fall under “eval” ;) If the SaveToDatabase finisher ever gets a frontend, there would be a challenge for the editor to place another finisher upstream. I don't want to make TYPO3 too complicated for the user. We can wait and see what someone else thinks, e.g. @garvin@hick.ing
  14. Garvin Hicking commented on patch set 3 07/15/25, 07:14

    Reply

    I understand both takes. I personally think though the current implementation is acceptable as it doesn't overly complicate things and is ready now for usage, especially given that the finisher now also already takes care of date/file conversions too. The fe_user case could be common for form registrations. And given the existing core finishers, most of these can perform functionality on their own; a finisher that pre-processes input only for transformation and nothing else is not existing yet. The others all "do something", like "save", "send mail", "show flash message", "delete uploaded files", "redirect". I do like the appeal of unix-like piping, but I think for integrators it would be easier to just set this flag than to insert new finishers. The code complexity isn't increasing by that much to force splitting it up (3 loc) IMO.
  15. Mathias Brodala commented on patch set 3 07/15/25, 07:22

    SaveToDatabaseFinisher.php:263

    Shorter: ``` $elementsConfiguration[$elementIdentifier]['hashed'] ?? false === true ```

    SaveToDatabaseFinisher.php:265

    Can/should we handle the possible "null" value on empty password?
  16. Mathias Brodala commented on patch set 3 07/15/25, 07:23

    Reply

    OK, fine with me then. Piping is a good keyword and something to consider for future changes. (Already did something like this in one project.)
  17. Josua Vogel uploaded patch set 4 CR -1 V +1 07/15/25, 08:22

  18. Mathias Brodala commented on patch set 4 07/15/25, 08:26

    SaveToDatabaseFinisher.php:263 Reply

    Done

    SaveToDatabaseFinisher.php:265 Reply

    Done
  19. Josua Vogel commented on patch set 4 07/15/25, 08:27

    SaveToDatabaseFinisher.php:263 Reply

    Done, thx!

    SaveToDatabaseFinisher.php:265 Reply

    Yes, if the value is null, you get an exception, while inserting. I added a check to only hash the value if it´s not empty/null.
  20. core-ci voted on patch set 4 V +1 07/15/25, 08:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81725

  21. Garvin Hicking commented on patch set 4 CR +1 V +1 07/16/25, 07:15

    SaveToDatabaseFinisher.php:263 Reply

    Done

    SaveToDatabaseFinisher.php:265 Reply

    Done
  22. Sven Liebert voted on patch set 4 CR +1 V +1 07/17/25, 09:28

  23. Simon Schaufelberger voted on patch set 4 CR +1 V +1 07/18/25, 00:10

  24. Garvin Hicking voted on patch set 4 CR +2 V +2 07/18/25, 14:35

  25. Garvin Hicking merged patch set 5 07/18/25, 14:36