Review main Abandoned

51740[SECURITY][FEATURE] Cleanup saltedpasswords api and add a new salt

Christian Futterlieb CR 0 V 0 Expert +1236 −48 updated 02/22/18, 13:28

Commit message

* Streamline inheritance of the SaltInterface and the abstract salt
  classes
* Add new abstract class AbstractPhpPasswordHashSalt for salts that
  use the php password api
* Add new salt class PhpPasswordHashBcryptSalt

Review

  • Code review CR 0
  • Verified V 0

Issues 2

Files 25

Show 5 more files

Review log 3953

Show 1928 earlier messages
  1. Christian Futterlieb uploaded patch set 1 02/18/17, 14:43

  2. TYPO3com voted on patch set 1 V -1 02/18/17, 14:57 Completed build in 13m 53s on Sat, 18 Feb, 03:57 PM Test Summary: 2 of 56527 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8221

  3. TYPO3com commented on patch set 1 02/18/17, 15:01 Completed build in 31m 46s on Sat, 18 Feb, 04:01 PM Test Summary: 56527 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8221

  4. Christian Futterlieb uploaded patch set 2 02/18/17, 21:44

  5. TYPO3com voted on patch set 2 V -1 02/18/17, 21:51 Completed build in 07m 25s on Sat, 18 Feb, 10:51 PM Test Summary: 56451 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8238

  6. Christian Futterlieb uploaded patch set 3 02/18/17, 22:15

  7. TYPO3com voted on patch set 3 V -1 02/18/17, 22:24 Completed build in 08m 14s on Sat, 18 Feb, 11:24 PM Test Summary: 56451 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8242

  8. Christian Futterlieb commented on patch set 3 02/18/17, 22:36

    > Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8242 Hi there! Can anyone please tell me what's going wrong there in the tests "Accept php70 my .."? I don't get it..
  9. Christian Futterlieb updated the commit message in patch set 4 02/18/17, 22:39

  10. TYPO3com voted on patch set 4 V -1 02/18/17, 22:46 Completed build in 06m 04s on Sat, 18 Feb, 11:46 PM Test Summary: 56451 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8244

  11. Christian Kuhn rebased onto patch set 5 02/18/17, 23:00

  12. TYPO3com voted on patch set 5 V -1 02/18/17, 23:12 Completed build in 11m 54s on Sun, 19 Feb, 12:12 AM Test Summary: 1 of 56526 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8246

  13. TYPO3com voted on patch set 5 V +1 02/18/17, 23:15 Completed build in 27m 28s on Sun, 19 Feb, 12:15 AM Test Summary: 56526 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8246

  14. Philipp Gampe commented on patch set 5 CR -1 02/23/17, 14:26

    we are past feature freeze, this can go into v9
  15. Benni Mack commented on patch set 5 CR -1 04/21/17, 14:32

    Renaming a PHP class is breaking, otherwise just introduce a ClassAlias legacy mapper and you're good to go. Christian F. can you take care of that?
  16. Oliver Klee commented on patch set 5 04/21/17, 14:57

    AbstractComposedSalt.php:58

    Can we please have return types for all new methods?
  17. Christian Futterlieb commented on patch set 5 04/22/17, 13:34

    @Benni Mack: Yes, I'll take care

    AbstractComposedSalt.php:58 Reply

    Sure. Should I add the return types for the 'old' methods as well? Imo we could take the chance as the class name change is breaking anyway, we'd just have to extend the rst. What do you mean?
  18. Oliver Klee commented on patch set 5 04/22/17, 13:36

    AbstractComposedSalt.php:58 Reply

    I'd prefer to have this in a separate clean-up change so cleanup and and new feature are separate.
  19. Christian Futterlieb commented on patch set 5 04/22/17, 13:38

    AbstractComposedSalt.php:58 Reply

    ok
  20. Christian Futterlieb uploaded patch set 6 05/05/17, 14:51

  21. Christian Futterlieb commented on patch set 6 05/05/17, 14:52

    note: patchset 6 is only a rebase on current master
  22. TYPO3com voted on patch set 6 V -1 05/05/17, 14:57 Completed build in 06m 05s on Fri, 5 May, 04:57 PM Test Summary: 55944 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-11232

  23. Jan Helke uploaded patch set 7 05/05/17, 15:09

  24. TYPO3com voted on patch set 7 V +1 05/05/17, 15:15 Completed build in 06m 04s on Fri, 5 May, 05:15 PM Test Summary: 55944 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-11233

  25. Oliver Klee commented on patch set 7 05/05/17, 15:15

    AbstractComposedSalt.php:58

    As we are PHP-7-only now, I propose having return type hints (and type hints for basic types like string).

    AbstractPhpPasswordHashSalt.php:47

    All these fields should have default values of the correct type.

    PhpPasswordHashBcryptSalt.php:21

    This class deserves some documentation.

    PhpPasswordHashBcryptSalt.php:48

    We can use int[] here to help static code analysis.
  26. Christian Futterlieb commented on patch set 7 05/05/17, 15:18

    AbstractComposedSalt.php:58 Reply

    Yes, you have mentioned it before (in ps 5), I'm on it ;-)
  27. Oliver Klee commented on patch set 7 05/05/17, 15:25

    AbstractComposedSalt.php:58 Reply

    Thanks! <3
  28. Christian Futterlieb commented on patch set 7 05/05/17, 15:25

    AbstractComposedSalt.php:58 Reply

    @Oliver Klee: As this class is the successor of AbstractSalt, every existing salt class must change its methods as well to stay compatible. Is this a no-go (breaking) or not?
  1. Christian Futterlieb commented on patch set 7 05/05/17, 15:29

    AbstractComposedSalt.php:58 Reply

    For clarification: these two methods were in SaltInterface before
  2. Oliver Klee commented on patch set 7 05/05/17, 15:30

    AbstractComposedSalt.php:58 Reply

    Oh, then we shouldn't change it. (I'm not sure about the official workflow for changing interfaces like this.)
  3. Christian Futterlieb commented on patch set 7 05/05/17, 15:53

    AbstractPhpPasswordHashSalt.php:47 Reply

    Why? As every hashing method will inherently have its own specifications, it therefor must declare them itself. Default values do not make any sense imho. I think it's a better idea to check the values before using them, for example in isValidSaltedPW()

    PhpPasswordHashBcryptSalt.php:21 Reply

    Yep, I'll add it

    PhpPasswordHashBcryptSalt.php:48 Reply

    I'm just curious: isn't this a problem with an associative array?
  4. Oliver Klee commented on patch set 7 05/05/17, 15:58

    AbstractPhpPasswordHashSalt.php:47 Reply

    The idea is that you then can rely on the fields having a value of the delared type no matter where in the program flow you are. This will make the type declaration "always correct", and the reader does not need to know that there are exceptions to the type (that are not documented in the @var).

    PhpPasswordHashBcryptSalt.php:48 Reply

    No. The type[] declaration only is a statement about the values, not about the keys.
  5. Christian Futterlieb commented on patch set 7 05/05/17, 16:07

    AbstractPhpPasswordHashSalt.php:47 Reply

    I agree, less type-juggling is better.. I'll define some defaults and add regarding checks in the code.

    PhpPasswordHashBcryptSalt.php:48 Reply

    Ok, thx =)
  6. Christian Futterlieb uploaded patch set 8 05/08/17, 11:17

  7. TYPO3com voted on patch set 8 V -1 05/08/17, 11:17 Completed build in 06s on Mon, 8 May, 01:17 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-11266

  8. Oliver Klee commented on patch set 8 05/08/17, 11:32

    InvalidSaltValueException.php:20

    I think this class deserves a more specific base class. Would RuntimeException be a good fit?

    PhpPasswordHashUndefinedSettingPrefixSalt.php:24

    @var missing for both (also in the other parallel classes)

    PhpPasswordHashUndefinedSettingPrefixSalt.php:28

    @return (also in the other parallel classes)

    PhpPasswordHashUndefinedSettingPrefixSalt.php:40

    This should be string, not mixed (also as type hint, if possible). (also in the other parallel classes)

    AbstractPhpPasswordHashSaltTest.php:57

    @param missing (also for the other tests that use data providers)

    AbstractPhpPasswordHashSaltTest.php:67

    @return and return type hinting missing: array (also for the other tests that use data providers)

    AbstractPhpPasswordHashSaltTest.php:80

    Please let's have a comma after the last array element. This makes adding a new line without modifying the existing lines possible.
  9. Christian Futterlieb commented on patch set 8 05/08/17, 12:35

    I'll fix the other mentioned issues in a minute

    InvalidSaltValueException.php:20 Reply

    I decided to use Exception, because there is no "ClassVarsNotProperlyDefinedException". Imo it's not a RuntimeException, I'd go for LogicException (or even ErrorException) instead.

    PhpPasswordHashUndefinedSettingPrefixSalt.php:40 Reply

    Yes, it should (to set a correct $settingPrefix), that's true. But in the scope of the test (and that is what this class is all about) it's used to assign all the values that won't fit, see AbstractPhpPasswordHashSaltTest::invalidSettingPrefixDataProvider()
  10. Christian Futterlieb uploaded patch set 9 05/08/17, 12:37

  11. TYPO3com voted on patch set 9 V -1 05/08/17, 12:37 Completed build in 05s on Mon, 8 May, 02:37 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-11267

  12. Oliver Klee commented on patch set 9 05/08/17, 14:01

    The build failure seems to be related to the composer.json. Maybe a rebase to the current master will solve this?
  13. Oliver Klee commented on patch set 9 05/08/17, 14:03

    Oh, it looks like you need to update the composer.json of the TYPO3 Core.
  14. Oliver Klee commented on patch set 8 05/08/17, 14:06

    InvalidSaltValueException.php:20 Reply

    LogicException sounds good to me.

    PhpPasswordHashUndefinedSettingPrefixSalt.php:40 Reply

    Ah, okay. Sounds fair. :-)
  15. Christian Futterlieb commented on patch set 9 05/08/17, 14:08

    > Oh, it looks like you need to update the composer.json of the TYPO3 > Core. Yes, I did, because of the registration of the ClassAliasMap.php. Do I have to commit the composer.lock as well, maybe?
  16. Christian Futterlieb uploaded patch set 10 05/08/17, 14:15

  17. TYPO3com voted on patch set 10 V -1 05/08/17, 14:16 Completed build in 05s on Mon, 8 May, 04:16 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-11268

  18. Oliver Klee commented on patch set 10 05/08/17, 15:44

    Yes, you'll need to update and commit the Core composer.lock as well.

    composer.json:80

    Please use tabs for indentation for the new lines so the indentation is consistent with the rest of the file.
  19. Christian Futterlieb uploaded patch set 11 05/08/17, 15:51

  20. TYPO3com voted on patch set 11 V -1 05/08/17, 15:56 Completed build in 05m 39s on Mon, 8 May, 05:56 PM Test Summary: 12 of 56187 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-11270

  21. Christian Futterlieb uploaded patch set 12 05/08/17, 16:09

  22. TYPO3com voted on patch set 12 V -1 05/08/17, 16:15 Completed build in 05m 40s on Mon, 8 May, 06:15 PM Test Summary: 56178 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-11271

  23. Christian Futterlieb abandoned the change 05/08/17, 18:00

    Abandon this change to split it up in smaller separate changes. the first one is: https://review.typo3.org/52737
  24. Christian Futterlieb commented on patch set 12 05/08/17, 18:20

    Second split task: https://review.typo3.org/52738 I can push the third one as soon as the first (https://review.typo3.org/52737) is merged
  25. Christian Futterlieb commented on patch set 12 02/22/18, 13:28

    fyi: 3rd and last split task (introduce the new salt classes): https://review.typo3.org/55668