Review main Merged

63272[BUGFIX] Throw BadRequestException on failed hmac validation from forms

Christian Eßl CR +2 V +2 Easy +38 −2 updated 02/18/20, 11:40

Commit message

If a HMAC of a submitted form is invalid (because it has been tampered
with), TYPO3 would previously throw an exception that leads to a
status code 500. This is incorrect behaviour, as the error comes from
bad user input and not a server error.

In case the HMAC of a submitted form is invalid, both extbase and
ext:form will now throw a BadRequestException, which will then lead to
a status code 400 (BAD REQUEST).

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Daniel Goerz +1
    • Markus Klein +1
    • Alexander Schnitzler +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Markus Klein +1
    • Alexander Schnitzler +1
    • TYPO3com +1 CI

Issues 1

Files 3

Review log 1418

  1. Christian Eßl uploaded patch set 1 02/16/20, 13:38

  2. TYPO3com voted on patch set 1 V -1 02/16/20, 13:51 Completed build in 12m 51s on Sun, 16 Feb, 01:51 PM Test Summary: 71295 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-171

  3. Christian Eßl uploaded patch set 2 02/16/20, 14:41

  4. TYPO3com voted on patch set 2 V -1 02/16/20, 14:55 Completed build in 14m 11s on Sun, 16 Feb, 02:55 PM Test Summary: 1 of 71757 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-173

  5. TYPO3com commented on patch set 2 02/16/20, 17:40 Completed build in 26m 11s on Sun, 16 Feb, 05:40 PM Test Summary: 71301 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-181

  6. Markus Klein commented on patch set 2 02/16/20, 19:08

    I would honestly say this is a bugfix and should be in v9 too.
  7. Christian Eßl uploaded patch set 3 02/17/20, 06:09

  8. TYPO3com voted on patch set 3 V +1 02/17/20, 06:24 Completed build in 15m 43s on Mon, 17 Feb, 06:24 AM Test Summary: 71301 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-187

  9. Markus Klein voted on patch set 3 CR +1 02/17/20, 07:46

  10. Markus Klein voted on patch set 3 V +1 02/17/20, 07:48

  11. Alexander Schnitzler commented on patch set 3 02/17/20, 08:40

    Just a short remark. I, personally, am a friend of adding @throws tags all the way up the stack until it's caught. In this case, that would mean many steps up but I think it would suffice to add those tags up until the processing of Extbase plugins begin. ContentObject -> Bootstrap. Adding those tags gives me a better overview of what exceptions may occur deep down in the code and which are actually already handled and which aren't. My personal goal is to have Extbase plugins behave like sub-requests in the future and therefore, I'd like to have a situation sometime when Extbase only throws HTTP-Exceptions to it's outside as main Exception with parent-exceptions that contain more information about the actual issue. Besides that: Good catch!
  12. Markus Klein commented on patch set 3 02/17/20, 08:50

    > Patch Set 3: > > Just a short remark. I, personally, am a friend of adding @throws tags all the way up the stack until it's caught. In this case, that would mean many steps up but I think it would suffice to add those tags up until the processing of Extbase plugins begin. ContentObject -> Bootstrap. Yes, I like that idea too.
  13. Alexander Schnitzler commented on patch set 3 02/17/20, 09:07

    > Patch Set 3: > > > Patch Set 3: > > > > Just a short remark. I, personally, am a friend of adding @throws tags all the way up the stack until it's caught. In this case, that would mean many steps up but I think it would suffice to add those tags up until the processing of Extbase plugins begin. ContentObject -> Bootstrap. > > Yes, I like that idea too. Just another short remark. There is no need to adjust this patch. We can use Rector\CodingStyle\Rector\Throw_\AnnotateThrowablesRector to automatically add @throws tags in the future.
  14. Daniel Goerz voted on patch set 3 CR +1 02/17/20, 09:18

  15. Alexander Schnitzler wrote 02/18/20, 08:48

    Topic set to extbase
  16. Alexander Schnitzler voted on patch set 3 V +1 CR +1 02/18/20, 08:52

  17. Georg Ringer voted on patch set 3 V +2 CR +2 02/18/20, 11:40

  18. Georg Ringer merged patch set 4 02/18/20, 11:40