magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.52k stars 9.31k forks source link

Invalid Form Key on catalog sorting when Remember Category Pagination and cache are enabled #34686

Open mrk-dzie opened 2 years ago

mrk-dzie commented 2 years ago

Preconditions (*)

  1. Remember Category Pagination option is enabled
  2. Cache is enabled
  3. Magento 2.4 or Magento 2.3.1+

Steps to reproduce

  1. Enable Full Cache and Remember Category Pagination option (catalog/frontend/remember_pagination)
  2. Visit any category page that contain products
  3. Remove cookies (or use incognito mode) and visit the same category page again.
  4. Try to change product list direction or order (the request is send by POST method and contains cached formKey not the one stored in cookies) Or try to change pagination count

Expected result

The toolbar action changes sorting direction and no error is displayed when cache and Remember Category Pagination are enabled

Actual result (*)

When the Remember Category Pagination option is enabled the toolbar widget is using POST method (Magento/Catalog/Block/Product/ProductList/Toolbar.php:752) and the form key is grabbed from possibly cached "formKey" options parameter. That will result an error (Invalid Form Key. Please refresh the page.) on toolbar action when full page cache is enabled and the product listing page is already cached by another user.

image


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 2 years ago

Hi @mrk-dzie. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

mrk-dzie commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @mrk-dzie. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @mrk-dzie, here is your Magento Instance: https://ed11299acd4f2befee67710bd8ae384f-2-4-develop.instances.magento-community.engineering Admin access: https://ed11299acd4f2befee67710bd8ae384f-2-4-develop.instances.magento-community.engineering/admin_f334 Login: 9cc06123 Password: 1b33bb75921d

mrk-dzie commented 2 years ago

The issue is reproducible on the vanilla Magento instance image

m2-assistant[bot] commented 2 years ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 2 years ago

Hi @mrk-dzie,

Thank you for reporting the issue. We are able to reproduce it on Magento 2.4-develop/2.4.3/2.4.3-p1. As we followed your steps to reproduce this bug.

image

Hence confirming this issue.

Thanks

github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-1828 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 years ago

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

makzef commented 2 years ago

@magento I am working on this

m2-assistant[bot] commented 2 years ago

Hi @makzef! :wave: Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

makzef commented 2 years ago

@magento add to contributors team

m2-assistant[bot] commented 2 years ago

Hi @makzef! :wave: Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.

makzef commented 2 years ago

@magento I am working on this