Review main Merged

96627[BUGFIX] Reject invalid form page index gracefully

Nikita Hovratov CR +2 V +2 Normal +134 −4 updated 11/11/26, 17:04

Commit message

The internal "__currentPage" argument of ext:form was cast to int
without any validation. Manipulated values like "-1 OR 5*5=25 -- ",
as sent by bots, resulted in a FormException about a non-existing
page, which got logged with alert severity for every request.

The value is now validated to be a non-negative integer. Otherwise
a BadRequestException is thrown, rendering the usual error message
in the frontend. Its exception code is registered as ignored code
in the exception handlers, the same way as for failed HMAC
validations, to avoid flooding the log with forged requests.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Josua Vogel +1
  • Verified V +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Josua Vogel +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 1417

  1. Nikita Hovratov uploaded patch set 1 10/12/26, 08:12

  2. core-ci voted on patch set 1 V +1 10/12/26, 08:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110891

  3. Josua Vogel commented on patch set 1 10/12/26, 08:30

    AbstractExceptionHandler.php:60

    This might be a bit nitpicky, but could you move the timestamp to the end of the list? My “inner Monk” wants the list to be sorted. Yes, that's not the case right now, but there's no need to add even more chaos with this patch.
  4. Nikita Hovratov uploaded patch set 2 V +1 10/12/26, 08:58

  5. Nikita Hovratov commented on patch set 2 10/12/26, 08:59

    AbstractExceptionHandler.php:60 Reply

    Done
  6. core-ci voted on patch set 2 V +1 10/12/26, 09:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110896

  7. Wouter Wolters voted on patch set 2 CR +1 V +1 10/12/26, 19:26

  8. Josua Vogel commented on patch set 2 10/12/26, 19:51

    AbstractExceptionHandler.php:57

    I just noticed that the new exception is listed under IGNORED_HMAC_EXCEPTION_CODES. That's technically incorrect. I'm not sure if we should ignore it. This list prevents logging, which is what we want in this case. We can't rename the list itself because the class isn't internal.
  9. Nikita Hovratov commented on patch set 2 11/10/26, 11:38

    AbstractExceptionHandler.php:57 Reply

    What would you suggest? Add a new list just for the one exception? Or add a comment for the constant, to explain this list is used to skip logging? Or maybe even make a complete new list?
  10. Josua Vogel uploaded patch set 3 CR +1 V +1 11/10/26, 14:39

  11. Josua Vogel commented on patch set 3 11/10/26, 14:40

    Addressed the logging classification finding by separating invalid-request exception codes from HMAC codes while retaining suppression in both handlers. Added core, frontend and form regression coverage. Unit tests, form functional tests, PHP integrity checks and CGL pass.
  12. Josua Vogel commented on patch set 3 11/10/26, 14:41

    AbstractExceptionHandler.php:57 Reply

    Yes, a new list. I already pushed the change 😊
  13. core-ci voted on patch set 3 V +1 11/10/26, 14:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113911

  14. Josua Vogel voted on patch set 3 CR +1 V +1 11/10/26, 15:00

  15. Georg Ringer voted on patch set 3 CR +1 V +1 11/10/26, 18:08

  16. Benni Mack voted on patch set 3 CR +2 V +2 11/11/26, 17:04

  17. Benni Mack merged patch set 4 11/11/26, 17:04