Review main Merged

70126[FEATURE] Access site configuration in foreign_table_where

Frank Nägler CR +2 V +2 Normal +146 −0 updated 08/25/21, 14:48

Commit message

This patch adds the possibility to access site configuration
with a placeholder in TCA's `foreign_table_where` query.

To access a configuration value the following syntax is available:

* ###SITE:rootPageId###
* ###SITE:foo.bar.baz### (array path notation)

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Wouter Wolters +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benni Mack +2
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 3040

Show 915 earlier messages
  1. Frank Nägler uploaded patch set 1 07/29/21, 10:59

  2. core-ci voted on patch set 1 V -1 07/29/21, 11:01 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13869

  3. Frank Nägler uploaded patch set 2 07/29/21, 11:06

  4. core-ci voted on patch set 2 V -1 07/29/21, 11:26 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13870

  5. Frank Nägler uploaded patch set 3 07/30/21, 07:19

  6. core-ci voted on patch set 3 V -1 07/30/21, 07:31 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13917

  7. Frank Nägler uploaded patch set 4 07/30/21, 09:11

  8. core-ci voted on patch set 4 V -1 07/30/21, 09:25 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13918

  9. Frank Nägler uploaded patch set 5 08/01/21, 09:31

  10. core-ci voted on patch set 5 V +1 08/01/21, 09:53 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13955

  11. Andreas Kienast commented on patch set 5 CR -1 08/02/21, 13:19

    on it
  12. Andreas Kienast uploaded patch set 6 08/02/21, 14:00

  13. core-ci voted on patch set 6 V +1 08/02/21, 14:20 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/13999

  14. Andreas Kienast voted on patch set 6 V +1 CR +1 08/03/21, 06:10

  15. Frank Nägler voted on patch set 6 V -1 08/03/21, 15:24

  1. Frank Nägler voted on patch set 6 V 0 08/03/21, 15:24

  2. Anja Leichsenring commented on patch set 6 V -1 08/03/21, 17:04

    I am not exactly convinced I got the issue right, here is what I found: I applied a site specfig clause to foreign_table_where in sys_file_metadata. Then I tried to edit that a record of this table in BE and was rejected with an error, caused by the DB. After debugging, I discovered that when rootPageId is 0, no replacement is done at all to the query. While in FE everything might be fine, what about BE? There usually is no site context, so this would fail.
  3. Andreas Kienast uploaded patch set 7 08/03/21, 18:35

  4. Andreas Kienast commented on patch set 7 CR -1 08/03/21, 18:35

    The syntax needs a change as this would introduce a third variant usable within foreign_table_where.
  5. core-ci voted on patch set 7 V -1 08/03/21, 18:56 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14059

  6. Andreas Kienast uploaded patch set 8 08/04/21, 13:28

  7. core-ci voted on patch set 8 V +1 08/04/21, 14:00 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14090

  8. Frank Nägler commented on patch set 8 CR +1 08/05/21, 18:15

    looks ok to me
  9. Andreas Kienast voted on patch set 8 V +1 CR +1 08/05/21, 18:36

  10. Oliver Hader commented on patch set 8 CR -1 08/05/21, 20:04

    AbstractItemProvider.php:844

    Bad: SQL error due to missing escaping; Worse: SQL injection

    AbstractItemProvider.php:897

    * What about `preg_replace_callback`? * Callback should be an instance method, shouldn't it?

    AbstractItemProvider.php:900

    `$value` can be any type... including `array` or `null`
  11. Andreas Kienast commented on patch set 8 08/06/21, 07:03

    AbstractItemProvider.php:844 Reply

    Ack

    AbstractItemProvider.php:897 Reply Unresolved

    `preg_replace_callback` would require to run the regex a second time. There's a guard clause in place to avoid _any_ processing if there's nothing to do.

    AbstractItemProvider.php:900 Reply

    The value comes from _configuration_ an administrator is responsible for. Sure, we can throw hard exceptions if it's neither a string nor an integer. Opinions?
  12. Frank Nägler commented on patch set 8 08/06/21, 07:09

    AbstractItemProvider.php:844 Reply

    Ack only for the quoting thingy, but I disagree for the SQL Injection. Since site configuration is "configuration", this like hacking 127.0.0.1.
  13. Benni Mack commented on patch set 8 08/06/21, 08:02

    AbstractItemProvider.php:900 Reply Unresolved

    We could use $connection->quote() for each value, if it's an array, we just use array_map($connection->quote)); ?
  14. Andreas Kienast uploaded patch set 9 08/08/21, 19:03

  15. core-ci voted on patch set 9 V +1 08/08/21, 19:14 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14290

  16. Andreas Kienast voted on patch set 9 CR +1 08/13/21, 12:59

  17. Wouter Wolters commented on patch set 9 08/13/21, 13:09

    AbstractItemProvider.php:881

    maybe better to rename $string to $foreignTableClause for better readability

    AbstractItemProvider.php:887

    I don't know what $re means. Maybe use a better var name

    TcaSelectItemsTest.php:925 Unresolved

    I miss a test here that shows me that when mySetting.notExists also works.
  18. Andreas Kienast uploaded patch set 10 08/14/21, 12:40

  19. Andreas Kienast commented on patch set 10 08/14/21, 12:40

    AbstractItemProvider.php:881 Reply

    Ack

    AbstractItemProvider.php:887 Reply

    Ack
  20. core-ci voted on patch set 10 V +1 08/14/21, 13:01 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15070

  21. Andreas Kienast voted on patch set 10 V +1 CR +1 08/18/21, 14:29

  22. Wouter Wolters voted on patch set 10 CR +1 08/19/21, 12:23

  23. Andreas Kienast commented on patch set 10 08/25/21, 07:07

    ping
  24. Benni Mack voted on patch set 10 V +2 CR +2 08/25/21, 14:48

  25. Benni Mack merged patch set 11 08/25/21, 14:48