Review main Merged

83698[BUGFIX] Fix array access error in EditableRestriction

Sybille Peters CR +2 V +2 Easy +6 −1 updated 06/21/24, 12:21

Commit message

The class EditableRestriction is used in EXT:linkvalidator to apply
permission restrictions to database queries for current (non-admin)
BE user.

In case of table sys_file_reference, the value for
$GLOBALS['TCA'][$table]['ctrl']['type'] might be "uid_local:type". In
that case, the class EditableRestriction tried to access the TCA
configuration for this field via $GLOBALS['TCA']['sys_file_reference']
['columns']['uid_local:type']['config']
when in fact this will be empty (and the type refers to the table
sys_file).

We now check if the resulting array is empty and skip the check if
that is the case.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 1

Review log 1518

  1. Sybille Peters uploaded patch set 1 04/08/24, 05:01

  2. Sybille Peters wrote 04/08/24, 05:02

    Topic set to Linkvalidator
  3. core-ci voted on patch set 1 V -1 04/08/24, 05:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55530

  4. Sybille Peters uploaded patch set 2 V -1 04/08/24, 05:15

  5. core-ci voted on patch set 2 V +1 04/08/24, 05:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55532

  6. Jörg Bösche voted on patch set 2 CR +1 04/08/24, 07:54

  7. Christian Kuhn voted on patch set 2 CR +1 04/08/24, 09:02

  8. Georg Ringer voted on patch set 2 CR +1 V +1 06/10/24, 13:18

  9. Garvin Hicking commented on patch set 2 06/10/24, 13:24

    EditableRestriction.php:68

    Check for "if ($fieldConfig === [])" here to clarify fallback intent, instead of falsy comparison?
  10. Andreas Kienast uploaded patch set 3 CR +1 V +1 06/10/24, 13:37

  11. Andreas Kienast commented on patch set 3 06/10/24, 13:37

    EditableRestriction.php:68 Reply

    Done
  12. core-ci voted on patch set 3 V +1 06/10/24, 13:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59013

  13. Sybille Peters commented on patch set 2 06/10/24, 13:43

    EditableRestriction.php:68 Reply

    Is this how it is generally done in the core or is this a question / suggestion? Can you point me to a source where it is explained, because I don't really understand the advantage?
  14. Andreas Kienast commented on patch set 3 06/10/24, 14:21

    EditableRestriction.php:68 Reply

    It's more explicit, we usually want to avoid "too wide" comparisons.
  15. Sybille Peters commented on patch set 3 06/10/24, 15:55

    EditableRestriction.php:68 Reply

    Marking as resolved, has been changed. Thanks.
  16. Benni Mack commented on patch set 3 CR +1 V +1 06/21/24, 09:47

    will hopefully be solved with Schema API soon
  17. Christian Kuhn voted on patch set 3 CR +2 V +2 06/21/24, 12:10

  18. Benni Mack merged patch set 4 06/21/24, 12:21