Review main Merged

74929[TASK] Use unsafe but faster password hashing in `RecoveryCodeTest`

Andreas Kienast CR +2 V +2 Normal +92 −23 updated 06/28/22, 07:52

Commit message

`RecoveryCodeTest` now uses a `NoopPasswordHash` implementation, that
uses sha1 internally. It's obviously not as secure as the til today
configured argon2 algorithm, but still fine for testing reasons, which
greatly improves the test runtime.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • Markus Klein +1
    • Stefan Bürk +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 2529

Show 34 earlier messages
  1. Andreas Kienast uploaded patch set 1 06/17/22, 20:16

  2. Markus Klein voted on patch set 1 CR +1 06/17/22, 20:23

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

  4. Oliver Klee commented on patch set 1 V +1 CR +1 06/17/22, 21:19

    Nice!
  1. Christian Kuhn commented on patch set 1 06/18/22, 07:38

    I get the idea. And yes, argon and it's variants are slow by design, and that's good. However, switching to (salted)md5 even for the tests isn't maybe the best option: We should deprecate salted-md5 sooner or later (it's not very secure, we made it up, and it's no standard), using it for tests is then an additional hurdle. May I ask you to try some of the other available ones instead? Maybe with reducing their cost-options? I'm pretty sure you'll find combinations that are very close to you current speedup.
  2. Christian Kuhn commented on patch set 1 06/18/22, 07:40

    Reply

    another option: add a dedicated test-fixture implementation that is a no-op we can use for tests (and for tests only, so make it a fixture). that would be clean, quick, and remove the dependency to any p/w-hash-implementation here.
  3. Andreas Kienast voted on patch set 1 CR -1 06/18/22, 07:55

  4. Oliver Klee commented on patch set 1 06/18/22, 08:30

    Ideas for names: - NullHash - NoopHash - DummyHash
  5. Andreas Kienast uploaded patch set 2 06/18/22, 10:45

  6. core-ci voted on patch set 2 V -1 06/18/22, 10:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28171

  7. Andreas Kienast uploaded patch set 3 06/18/22, 11:18

  8. core-ci voted on patch set 3 V +1 06/18/22, 11:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28173

  9. Markus Klein commented on patch set 3 CR -1 06/18/22, 14:20

    RecoveryCodesTest.php:42

    nope. ;-)
  10. Markus Klein commented on patch set 4 06/18/22, 14:21

    Published edit on patch set 3.
  11. Markus Klein commented on patch set 4 CR +1 06/18/22, 14:22

    RecoveryCodesTest.php:42 Reply

    Done
  12. core-ci voted on patch set 4 V +1 06/18/22, 14:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28176

  13. Oliver Klee commented on patch set 4 V +1 CR +1 06/18/22, 15:24

    Reply

    Done
  14. Simon Schaufelberger commented on patch set 4 06/18/22, 20:37

    NoopPasswordHash.php:36

    do we want to use __CLASS__ or self::class? The core usually uses self::class I think

    NoopPasswordHash.php:54

    a noop hashing that still uses sha1? Why not just plain text here?
  15. Andreas Kienast commented on patch set 4 06/18/22, 20:51

    NoopPasswordHash.php:36 Reply

    Both is used within Core.

    NoopPasswordHash.php:54 Reply

    That's what lolli suggested in Slack. We have some kind of hashing which is still cheap enough.
  16. Simon Schaufelberger commented on patch set 4 06/18/22, 20:53

    NoopPasswordHash.php:54 Reply

    Yeah but then I wouldn't call it Noop because it still does something instead of the expected "nothing".
  17. Simon Schaufelberger commented on patch set 4 06/18/22, 21:02

    I

    NoopPasswordHash.php:54 Reply

    I propose to leave out the prefix and just go with plaintext. Then we have indeed a noop hashing.
  18. Andreas Kienast commented on patch set 4 06/18/22, 21:37

    NoopPasswordHash.php:54 Reply

    Probably the most important reason not to do this is to prevent database-related issues like charset or field length constraints.
  19. Oliver Klee commented on patch set 4 06/18/22, 21:43

    According to https://stackoverflow.com/questions/3665247/fastest-hash-for-non-cryptographic-uses, CRC32 is (or was in 2010) the fastest hash algorithm in PHP. Maybe we can switch to that.
  20. Christian Kuhn commented on patch set 4 06/18/22, 23:59

    Reply

    guys. hashing a short string of a couple of chars is nanoseconds! that's essentially no-op in php-world. no matter if crc, sha1 / sha256 or md5. you want to have something here that can't produce special chars to not run into whatever quoting issues. a sha() is fine, imho.
  21. Christian Kuhn commented on patch set 4 V +1 CR +1 06/19/22, 00:08

    NoopPasswordHash.php:36 Reply

    Done

    NoopPasswordHash.php:54 Reply

    see my other comment.
  22. Stefan Bürk voted on patch set 4 V +1 CR +1 06/19/22, 00:10

  23. Christian Kuhn voted on patch set 4 V +2 CR +2 06/19/22, 00:21

  24. Christian Kuhn merged patch set 5 06/19/22, 00:22

  25. Oliver Hader voted on patch set 5 CR +1 06/28/22, 07:52