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.51k stars 9.31k forks source link

Duplicate Form Key Cookie #36248

Open mvenghaus opened 2 years ago

mvenghaus commented 2 years ago

Preconditions and environment

Steps to reproduce

  1. Open any page with page cache enabled. Ex: https://demoshops.splendid-internet.de/magento/demoshop-magento2-daily/hero-hoodie.html -> first form_key by js

  2. Select size & color -> second form_key by php

Expected result

one "form_key" cookie

Actual result

there are two cookies "form_key" "form_key"

Additional information

when the cookie is handled by php there is always a dot prefix in the domain

https://github.com/magento/magento2/blob/2.4-develop/lib/internal/Magento/Framework/View/Element/Js/Cookie.php#L64

when the js form-key-provider.js sets the cookie, there is no configuration for the domain and the cookie is set without the dot

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/PageCache/view/frontend/web/js/form-key-provider.js#L30

Release note

No response

Triage and priority

m2-assistant[bot] commented 2 years ago

Hi @mvenghaus. 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.

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

m2-assistant[bot] commented 2 years ago

Hi @engcom-November. 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-November commented 2 years ago

Hi @mvenghaus , Thank you for reporting and collaboration. Verified the issue on both Magento 2.4-develop instance and 2.4.5 project-community-edition as well but the issue is not reproducible. Only one "form_key" cookie is present as displayed below: image Kindly check the behavior on Magento 2.4-develop instance / elaborate missing steps / configuration details if the issue is still reproducible. Thank you.

mvenghaus commented 2 years ago

@engcom-November

Step 1 open https://demoshops.splendid-internet.de/magento/demoshop-magento2-daily/hero-hoodie.html -> first form_key by js

Step 2 select size & color -> second form_key by php

.. and thx for the fast reply ;)

engcom-November commented 2 years ago

Thank you for the reponse @mvenghaus . Verified the issue again on Magento 2.4-develop instance with above mentioned steps and the issue is reproducible. Hence updating the description and confirming the issue. image

github-jira-sync-bot commented 2 years ago

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

m2-assistant[bot] commented 2 years ago

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

github-jira-sync-bot commented 2 years ago

:x: You don't have permission to export this issue.