Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin | Some cookies are misusing the recommended “SameSite“ attribute #34461

Closed
1 task done
salehawal opened this issue Oct 28, 2021 · 37 comments
Closed
1 task done
Labels
Component: AdminAnalytics Issue: needs update Additional information is require, waiting for response Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.

Comments

@salehawal
Copy link

salehawal commented Oct 28, 2021

Preconditions (*)

  1. php 7.4.3
  2. magento 2.4-develop

Steps to reproduce (*)

  1. install latest magento 2.4-develop
  2. add ssl to yoru site
  3. login to backend

Expected result (*)

Screenshot from 2021-10-28 10-34-51

Actual result (*)

Screenshot from 2021-10-28 10-32-43
2.
Screenshot from 2021-10-28 10-33-00


  • Severity: S2
@m2-assistant
Copy link

m2-assistant bot commented Oct 28, 2021

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

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

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.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 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.

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

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

@ihor-sviziev
Copy link
Contributor

@salehawal,
it looks like you have some cookies set on the main domain .darelm.io that don't provide "SameSite" cookies, it's not related to the Magento.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Oct 28, 2021

@salehawal, just checker further - it looks like these cookies are set automatically on the top domain on the Magento Cloud and it's not related to the Magento Open Source (or EE / B2B).
https://experienceleague.adobe.com/docs/id-service/using/intro/cookies.html?lang=en

I think you should contact your Magento Cloud support for that.

@salehawal
Copy link
Author

@ihor-sviziev .. this is from ssl localhost, the domain is set via /etc/hosts and the app server is apapche2

@ihor-sviziev
Copy link
Contributor

@salehawal, so in this case you should remove the AMCV_* and AMCVS_* cookies manually.

@salehawal
Copy link
Author

@ihor-sviziev .. i searched the entire code base for "AMCV_" i cant find the file?

@ihor-sviziev
Copy link
Contributor

@salehawal these cookies are saved in your browser. Magento doesn't set them.

@salehawal
Copy link
Author

i think it is not from the AMCV, because home page is running with no problem:
Screenshot from 2021-10-28 10-34-51

i think it is coming from another source, i can only see the generated js code but dont where it is comming from?
Screenshot from 2021-10-28 16-20-19

generated js code: launch-177bc126c8e6.min.js
....>>
p=this,g=t.whitelistParentDomain;p.state={ALLFIELDS:{}},p.version=n.version,p.marketingCloudOrgID=e,p.cookieDomain=n.cookieDomain||"";var m=!(p._instanceType="child"),h=new J(e,g);p.callbackRegistry=M(),p.init=function(){d(),f(),i(new E(p)),l()},p.findField=function(e,t){if(void 0!==p.state[e])return t(p.state[e]),p.state[e]},p.messageParent=s,p.setStateAndPublish=o},x=Y.MESSAGES,j=Y.ALL_APIS,R=Y.ASYNC_API_MAP,N=Y.FIELDGROUP_TO_FIELD,K=function(i,r){function o(){var r={};return Object.keys(j).forEach(function(e){var t=j[e],n=i[t]();X.isValueEmpty(n)||(r[e]=n)}),r}function a(){var n=[];return i._loading&&Object.keys(i._loading).forEach(function(e){if(i._loading[e]){var t=N[e];n.push(t)}}),n.length?n:null}function t(n){return function r(){var e=a();if(e){var t=R[e[0]];i[t](r,!0)}else n()}}function n(e,t){var n=o();r.send(e,t,n)}function s(e){u(e),n(e,x.HANDSHAKE)}function c(e){t(function(){n(e,x.PARENTSTATE)})()}function u(t){function e(e){n.call(i,e),r.send(t,x.PARENTSTATE,{CUSTOMERIDS:i.getCustomerIDs()})}var n=i.setCustomerIDs;i.setCustomerIDs=e}return function(e){r.isInvalid(e)||(r.parse(e).prefix===x.HANDSHAKE?s:c)(e.source)}},$=function(r,n){function i(t){return function(e){o[t]=e,++a===s&&n(o)}}var o={},a=0,s=Object.keys(r).length;Object.keys(r).forEach(function(e){var t=r[e];if(t.fn){var n=t.args||[];n.unshift(i(e)),t.fn.apply(t.context||null,n)}})},z={get:function(e){e=encodeURIComponent(e);var t=(";"+document.cookie).split(" ").join(";"),n=t.indexOf(";"+e+"="),r=n<0?n:t.indexOf(";",n+1);return n<0?"":decodeURIComponent(t.substring(n+2+e.length,r<0?t.length:r))},set:function(e,t,n){var r=f(n,"cookieLifetime"),i=f(n,"expires"),o=f(n,"domain"),a=f(n,"secure"),s=f(n,"sameSite"),c=a?"Secure":"",u=s?"SameSite="+s+";":"";if(i&&"SESSION"!==r&&"NONE"!==r){var l=""!==t?parseInt(r||0,10):-60;if(l)(i=new Date).setTime(i.getTime()+1e3*l);else if(1===i){var d=(i=new Date).getYear();i.setYear(d+2+(d<1900?1900:0))}}else i=0;return e&&"NONE"!==r?(document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+"; path=/;"+(i?" expires="+i.toGMTString()+";":"")+(o?" domain="+o+";":"")+u+c,this.get(e)===t):0},remove:function(e,t){var n=f(t,"domain");n=n?" domain="+n+";":"";var r=f(t,"secure"),i=f(t,"sameSite"),o=r?"Secure":"",a=i?"SameSite="+i+";":"";document.cookie=encodeURIComponent(e)+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"+n+a+o}},Q=function(e,t){!e&&W.location&&(e=W.location.hostname);var n,r=e.split("."),i=t||{};for(n=r.length-2;0<=n;n--)if(i.domain=r.slice(n).join("."),z.set("test","cookie",i))return z.remove("test",i),i.domain;return""},Z={compare:n,isLessThan:function(e,t){return n(e,t)<0},areVersionsDifferent:function(e,t){return 0!==n(e,t)},isGreaterThan:function(e,t){return 0<n(e,t)},isEqual:function(e,t){return 0===n(e,t)}},F=!!W.postMessage,ee={postMessage:function(e,t,n){var r=1;t&&(F?n.postMessage(e,t.replace(/([^:]+:\/\/[^\/]+).*/,"$1")):t&&(n.location=t.replace(/#.*$/,"")+"#"+ +new Date+r+++"&"+e))},receiveMessage:function(t,n){var e;try{F&&(t&&(e=function(e){if("string"==typeof n&&e.origin!==n||"[object Function]"===Object.prototype.toString.call(n)&&!1===n(e.origin))return!1;t(e)}),W.addEventListener?W[t?"addEventListener":"removeEventListener"]("message",e):W[t?"attachEvent":"detachEvent"]("onmessage",e))}catch(t){}}},te=function(e){var t,n,r="0123456789",i="",o="",a=8,s=10,c=10;if(1==e){for(r+="ABCDEF",t=0;t<16;t++)n=Math.floor(Math.random()*a),i+=r.substring(n,n+1),n=Math.floor(Math.random()*a),o+=r.substring(n,n+1),a=16;return i+"-"+o}for(t=0;t<19;t++)n=Math.floor(Math.random()*s),i+=r.substring(n,n+1),0===t&&9==n?s=3:(1==t||2==t)&&10!=s&&n<2?s=10:2<t&&(s=10),n=Math.floor(Math.random()*c),o+=r.substring(n,n+1),0===t&&9==n?c=3:(1==t||2==t)&&10!=c&&n<2?c=10:2<t&&(c=10);return i+o},ne=function(r){return{corsMetadata:(e="none",t=!0,"undefined"!=typeof XMLHttpRequest&&XMLHttpRequest===Object(XMLHttpRequest)&&("withCredentials"in new XMLHttpRequest?e="XMLHttpRequest":"undefined"!=typeof XDomainRequest&&XDomainRequest===Object(XDomainRequest)&&(t=!1),0<Object.prototype.toString.call(
<<...

@salehawal
Copy link
Author

salehawal commented Oct 28, 2021

@ihor-sviziev
ok i found the file it is related to adobe :
https://assets.adobedtm.com/a7d65461e54e/37baabec1b6e/launch-177bc126c8e6.js

is included here:
app/code/Magento/AdminAnalytics/view/adminhtml/layout/default.xml

so now is there why to fix this or i should just comment it out?

@ihor-sviziev
Copy link
Contributor

@salehawal,
ok. Thank you for the additional info! It's related to the admin analytics module.
It looks like this is a bug in one of the Magento modules.

I think it shouldn't cause any issues to the non-analytics functionality of the admin page.

@ihor-sviziev ihor-sviziev added the Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. label Oct 28, 2021
@salehawal
Copy link
Author

salehawal commented Oct 28, 2021

for now this is the solution:
1- disable this module:
bin/magento module:disable Magento_AdminAnalytics

2- rebuild magento and clear the cache

bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento indexer:reset
bin/magento indexer:reindex
bin/magento setup:static-content:deploy -f
bin/magento cache:enable
bin/magento cache:clean
bin/magento cache:flush

3- clear browser cache and reload the admin page

@salehawal
Copy link
Author

it is also related to this issue : #34476
tried to remove "Magento_AdminAnalytics" but it is still not working, to confirm and checkedout 2.4.3 branch and install it and it is working great .. one thing i notice is that when i login in admin area, it asked me for a security question to allow user and i allwed and continue working

@salehawal
Copy link
Author

salehawal commented Nov 2, 2021

i have resolved the issue by downloading the file "https://assets.adobedtm.com/a7d65461e54e/37baabec1b6e/launch-177bc126c8e6.js" and move it under /pub directory ad updating caller url with the new url of edited file as follow:
1- save and edit the file adding "secure" in code to force all cookies to be secure

u = s ? "Secure" : "Secure",
o = r ? "Secure" : "Secure",

2- update the file call url in "/app/code/Magento/AdminAnalytics/view/adminhtml/layout/default.xml"

<!-- <argument name="tracking_url" xsi:type="string">//assets.adobedtm.com/a7d65461e54e/37baabec1b6e/launch-177bc126c8e6.min.js</argument> -->
 <argument name="tracking_url" xsi:type="string">https://magento.darelm.io/pub/launch.min.js</argument>

it is a quick and dirty solution, but i hope for a better solution in the next update
Screenshot from 2021-11-02 22-06-58

but it seems that admin is still not resolved and the problem for it spinning forever was not the same site issue from the start
Screenshot from 2021-11-02 22-07-11

so we move on with the spinner issue on this ticket #34476

@m2-assistant
Copy link

m2-assistant bot commented Dec 29, 2021

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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

Hi @engcom-Hotel, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

Hi @engcom-Hotel, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@engcom-Hotel engcom-Hotel removed their assignment Jan 11, 2022
@engcom-November
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@engcom-November
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

Hi @engcom-November, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

1 similar comment
@magento-deployment-service
Copy link

Hi @engcom-November, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@engcom-November
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

Hi @engcom-November, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@slavvka
Copy link
Member

slavvka commented Jan 20, 2022

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @slavvka. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@engcom-Lima
Copy link
Contributor

Hi @salehawal,

Thank you for reporting the issue.

I have tried this issue on the fresh installation Magento 2.4-dev but I am not able to reproduce it.
Screenshot from 2022-02-02 18-20-22

Kindly recheck the issue on Magento 2.4-develop branch and elaborate the steps if the issue is still reproducible.
Thank you.

@engcom-Lima engcom-Lima added the Issue: needs update Additional information is require, waiting for response label Feb 2, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Feb 2, 2022
@engcom-Hotel
Copy link
Contributor

Dear @salehawal,

We have noticed that this issue has not been updated for a period of 14 Days. Hence we assume that this issue is fixed now, so we are closing it. Please raise a fresh ticket or reopen this ticket if you need more assistance on this.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: AdminAnalytics Issue: needs update Additional information is require, waiting for response Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
None yet
Development

No branches or pull requests

6 participants