Review main Merged

62385[BUGFIX] Avoid applying parameter inflation during route resolving

Oliver Hader CR +2 V +2 Normal +215 −10 updated 11/28/19, 06:06

Commit message

Remaining parameters need to be deflated (prepared and normalized to
strings and fitting into Symfony route length and literal constraints)
during route generation.

However, when resolving a route remaining query parameters have to be
kept as is - explained in more detail in the following examples based
on using enhancer with namespace set to 'app':

* https://example.org/page/route-value/app__value=inject
  + previously assigned `app[value]=inject` -> dirty -> rejected
  + not inflated anymore, kept as `app_value`
* https://example.org/page/route-value/app__other=inject
  + previously assigned `app[other]=inject` -> okay, wrong namespace
  + not inflated anymore, kept as `app__other`
* https://example.org/page/route-value/[32+ characters]=inject
  + arbitrary characters lead to OutOfRangeException -> no valid hash
  + previously `md5('app__@any__value')` assigned `app[@any][value]`
    -> dirty -> rejected
  + not inflated anymore, kept as `md5('app__@any__value')`

Basically the mentioned OutOfRangeException revealed that misbehavior,
hacking `VariableProcessor::resolveHash` would not have solve issues
with (incorrectly) merged query parameters - but would have hidden it.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Frank Nägler +1
    • Michael Telgkamp +1
  • Verified V +2 Done
    • Susi Moog +2
    • Michael Telgkamp +1
    • TYPO3com +1 CI

Issues 1

Files 6

Review log 2331

Show 46 earlier messages
  1. Oliver Hader uploaded patch set 1 11/22/19, 17:25

  2. Oliver Hader updated the commit message in patch set 2 11/22/19, 17:26

  3. TYPO3com voted on patch set 1 V +1 11/22/19, 17:33 Completed build in 07m 59s on Fri, 22 Nov, 05:33 PM Test Summary: 48102 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38677

  4. TYPO3com voted on patch set 2 V +1 11/22/19, 17:35 Completed build in 07m 06s on Fri, 22 Nov, 05:35 PM Test Summary: 48104 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38679

  5. Oliver Hader uploaded patch set 3 11/23/19, 09:51

  6. Oliver Hader updated the commit message in patch set 4 11/23/19, 09:56

  1. TYPO3com voted on patch set 3 V -1 11/23/19, 09:59 Completed build in 07m 52s on Sat, 23 Nov, 09:59 AM Test Summary: 9 of 48505 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38711

  2. Oliver Hader uploaded patch set 5 11/23/19, 10:01

  3. TYPO3com voted on patch set 4 V -1 11/23/19, 10:03 Completed build in 07m 00s on Sat, 23 Nov, 10:03 AM Test Summary: 9 of 48250 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38712

  4. Oliver Hader updated the commit message in patch set 6 11/23/19, 10:06

  5. TYPO3com voted on patch set 5 V +1 11/23/19, 10:10 Completed build in 08m 40s on Sat, 23 Nov, 10:10 AM Test Summary: 48167 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38714

  6. Benni Mack voted on patch set 6 V +1 CR +1 11/23/19, 10:11

  7. TYPO3com voted on patch set 6 V +1 11/23/19, 10:14 Completed build in 07m 42s on Sat, 23 Nov, 10:14 AM Test Summary: 48167 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38716

  8. Benni Mack voted on patch set 6 V 0 CR 0 11/23/19, 10:14

  9. Oliver Hader voted on patch set 6 CR +1 11/23/19, 10:25

  10. Oliver Hader voted on patch set 6 CR 0 11/23/19, 10:25

  11. Oliver Hader commented on patch set 6 11/23/19, 10:46

    EnhancerSiteRequestTest.php:783

    hm...
  12. Oliver Hader commented on patch set 7 11/23/19, 10:47

    Published edit on patch set 6.
  13. Oliver Hader commented on patch set 7 11/23/19, 10:47

    EnhancerSiteRequestTest.php:783 Reply

    Done
  14. TYPO3com voted on patch set 7 V +1 11/23/19, 10:54 Completed build in 07m 33s on Sat, 23 Nov, 10:54 AM Test Summary: 48167 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38727

  15. Michael Telgkamp commented on patch set 7 CR -1 11/23/19, 15:57

    In `VariableProcessor::inflateArray` there should be the change from `$this->resolveHash($key)` to `$this->resolveHash((string)$key)` as a hash of a string might be number only (e.g. `md5('ximaz')`) and a number only sting used as key of an array is converted to a number and thus results in an exception when used for the function `resolveHash(string $hash): string`. It is not the main focus of the issue, so it could also be considered to be solved in an additional ticket.
  16. Oliver Hader commented on patch set 7 11/23/19, 17:03

    > Patch Set 7: Code-Review-1 > > In `VariableProcessor::inflateArray` there should be the change from `$this->resolveHash($key)` to `$this->resolveHash((string)$key)` as a hash of a string might be number only (e.g. `md5('ximaz')`) and a number only sting used as key of an array is converted to a number and thus results in an exception when used for the function `resolveHash(string $hash): string`. It is not the main focus of the issue, so it could also be considered to be solved in an additional ticket. Sure, let's integrate a test for that, it fits perfectly well...
  17. Oliver Hader commented on patch set 7 11/23/19, 17:20

    > Patch Set 7: > > > Patch Set 7: Code-Review-1 > > > > In `VariableProcessor::inflateArray` there should be the change from `$this->resolveHash($key)` to `$this->resolveHash((string)$key)` as a hash of a string might be number only (e.g. `md5('ximaz')`) and a number only sting used as key of an array is converted to a number and thus results in an exception when used for the function `resolveHash(string $hash): string`. It is not the main focus of the issue, so it could also be considered to be solved in an additional ticket. > > Sure, let's integrate a test for that, it fits perfectly well... No change required since this is considered already when a hash is being generated, see https://github.com/TYPO3/TYPO3.CMS/blob/e6903b8b866aa4be211c31e507ec9e80158d967b/typo3/sysext/core/Classes/Routing/Enhancer/VariableProcessor.php#L49 Anyway, let's add a test for it.
  18. Oliver Hader uploaded patch set 8 11/23/19, 17:20

  19. Oliver Hader commented on patch set 8 11/23/19, 17:21

    > Patch Set 7: > > > Patch Set 7: > > > > > Patch Set 7: Code-Review-1 > > > > > > In `VariableProcessor::inflateArray` there should be the change from `$this->resolveHash($key)` to `$this->resolveHash((string)$key)` as a hash of a string might be number only (e.g. `md5('ximaz')`) and a number only sting used as key of an array is converted to a number and thus results in an exception when used for the function `resolveHash(string $hash): string`. It is not the main focus of the issue, so it could also be considered to be solved in an additional ticket. > > > > Sure, let's integrate a test for that, it fits perfectly well... > > No change required since this is considered already when a hash is being generated, see > https://github.com/TYPO3/TYPO3.CMS/blob/e6903b8b866aa4be211c31e507ec9e80158d967b/typo3/sysext/core/Classes/Routing/Enhancer/VariableProcessor.php#L49 > > Anyway, let's add a test for it. Additional test, see https://review.typo3.org/c/Packages/TYPO3.CMS/+/62385/7..8/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequestTest.php
  20. TYPO3com voted on patch set 8 V +1 11/23/19, 17:27 Completed build in 06m 57s on Sat, 23 Nov, 05:27 PM Test Summary: 48227 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38781

  21. Michael Telgkamp commented on patch set 8 V +1 CR +1 11/25/19, 08:30

    Looks good for me and applying the patch to 9.5 it also works with the actual problem I had in the 9.5 project.
  22. Benni Mack voted on patch set 8 CR +2 11/27/19, 21:11

  23. Frank Nägler voted on patch set 8 CR +1 11/27/19, 21:35

  24. Susi Moog commented on patch set 8 V +2 11/28/19, 06:05

    tested on my live web site :-D
  25. Susi Moog merged patch set 9 11/28/19, 06:06