Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Work in progress Orphaned

67656[FEATURE] Add CSRF protection for frontend forms (ext:form)

Ralf Zimmermann CR -1 V -1 Hard +644 −5 updated 03/28/25, 09:47

Commit message

Forms built with ext:form are now hardened against
Cross-Site-Request-Forgery (CSRF) protection.
This is done by make use of the `FormProtection` component which is
included in ext:core.
The implementation make use of the synchronizer token pattern and
generates a new token for each request.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 11
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/56/67656/11 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/56/67656/11 && git cherry-pick FETCH_HEAD

Review

  • Code review CR -1 Needs a vote
    • waldhacker -1
  • Verified V -1 Blocked
    • core-ci -1 CI

Relation chain 3

  1. 67656 [FEATURE] Add CSRF protection for frontend forms (ext:form) This change

  2. main 67642[BUGFIX] Proper honeypot validation if no session data exists This change is based on it Abandoned Ralf Zimmermann CR 0 V 0 → 11.5 Expert +912 −166

    The chain has patch set 32 of 38, the changes above it need a rebase.

  3. main 70460[BUGFIX] Ensure uncached forms in case of POST requests This change is based on it Merged waldhacker CR +2 V +2 → 11.5, 10.4 Hard +342 −124

    The chain has patch set 21 of 56, the changes above it need a rebase.

Issues 1

Files 31

Show 11 more files

Review log 2336

Show 611 earlier messages
  1. Ralf Zimmermann uploaded patch set 1 02/06/21, 11:21

  2. TYPO3com voted on patch set 1 V -1 02/06/21, 11:22 Completed build in 21s on Sat, 6 Feb, 11:22 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9323

  3. Ralf Zimmermann commented on patch set 2 02/06/21, 15:28

    Published edit on patch set 1.
  4. TYPO3com voted on patch set 2 V -1 02/06/21, 15:28 Completed build in 21s on Sat, 6 Feb, 03:28 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-9324

  5. core-ci voted on patch set 1 V +1 02/06/21, 18:44 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/439

  6. core-ci voted on patch set 2 V +1 02/06/21, 18:49 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/440

  7. Oliver Hader updated the commit message in patch set 3 04/21/21, 16:06

  8. TYPO3com voted on patch set 3 V -1 04/21/21, 16:06 Completed build in 16s on Wed, 21 Apr, 04:06 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10785

  9. waldhacker uploaded patch set 4 08/11/21, 13:44

  10. waldhacker uploaded patch set 5 08/11/21, 13:48

  11. waldhacker uploaded patch set 6 08/11/21, 13:52

  1. core-ci voted on patch set 4 V -1 08/11/21, 14:04 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14594

  2. core-ci voted on patch set 5 V -1 08/11/21, 14:08 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14595

  3. core-ci voted on patch set 6 V -1 08/11/21, 14:18 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14596

  4. waldhacker voted on patch set 6 CR -1 08/11/21, 16:26

  5. waldhacker commented on patch set 6 08/12/21, 00:10

    Have to wait until https://review.typo3.org/c/Packages/TYPO3.CMS/+/70460 is fixed. The caching determination can then be removed here.
  6. waldhacker uploaded patch set 7 08/12/21, 15:13

  7. waldhacker voted on patch set 7 CR -1 08/12/21, 15:22

  8. core-ci voted on patch set 7 V -1 08/12/21, 15:45 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14777

  9. waldhacker uploaded patch set 8 08/13/21, 18:07

  10. waldhacker voted on patch set 8 CR -1 08/13/21, 18:30

  11. core-ci voted on patch set 8 V -1 08/13/21, 18:37 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15015

  12. waldhacker uploaded patch set 9 08/14/21, 15:57

  13. waldhacker uploaded patch set 10 08/14/21, 15:58

  14. core-ci voted on patch set 10 V -1 08/14/21, 16:30 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15094

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

  16. Benjamin Franzke commented on patch set 10 CR -1 08/30/21, 08:21

    AntiCsrfRegistry.php:53

    Hm. IMO we shouldn't (unconditionally!) post-process *every* response in a middleware. Isn't there another way to achieve this? Can we put a header into the cache that can be parsed here? If we'd really really need to to this in a middleware, we should at least check the content-type to avoid parsing file-downloads (that may use a lazy-loaded-stream) or apis. So at least restrict to html content-type?
  17. waldhacker commented on patch set 10 CR -1 08/30/21, 08:29

    AntiCsrfRegistry.php:53 Reply Unresolved

    on it
  18. Benni Mack wrote 11/29/21, 10:10

    Change destination moved from master to main
  19. Benni Mack updated the commit message in patch set 11 11/29/21, 13:25

  20. core-ci voted on patch set 11 V -1 11/29/21, 15:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20022

  21. waldhacker marked it work in progress 02/23/22, 08:18

  22. waldhacker commented on patch set 11 CR -1 04/28/22, 07:10

    This change is ready for review.
  23. Simon Schaufelberger commented on patch set 11 04/30/22, 01:38

    FrontendFormProtection.php:32 Unresolved

    since we use php8 only, you can remove the annotation and use the native type
  24. waldhacker marked it work in progress 04/30/22, 09:40

  25. Benni Mack wrote 03/28/25, 09:47

    Topic set to form