Skip to content

local/session storage is mismanaged, particularly when it doesn't exist #16568

Closed
@dan-ding

Description

@dan-ding

Essentially, users carts will disappear or they won't be able to login, or they'll be logged out or some other session related wackyiness.

creating here from #7931 as @orlangur said to make a new one

There are multiple reasons why this is occurring -- the follow is the first way I've found to recreate an a problem easily.

https://github.com/julien-maurel/jQuery-Storage-API/blob/d2ce10b0fb53d7cb919f14e70853a5c232477f93/jquery.storageapi.js#L423

Preconditions

  1. magento 2.2.0 + (updated)
  2. customers who want to buy things

Steps to reproduce

One way to reproduce is:

  1. install firefox;
  2. disable localstorage in firefox (about:config dom.storage.enabled == false);
  3. browse around the catalog;
  4. while on a product listing page, identify a product that really is interesting;
  5. open the product detail page in a new window/tab;
  6. decide the product isn't for you and close the product detail window/tab;
  7. browse around some more;
  8. on a product listing page identify a product you'd like to know more about;
  9. open the product detail page in a new tab/window;
  10. decide you don't want it and close the tab/window;
  11. do this eight more times until you find a product you want;
  12. try to log in or add it to your cart;
  13. try to checkout;
  14. look for your cart;
  15. look at your cookies and see billions (exaggeration) of them.
  16. look at your magento log and see maximum cookies error

Expected result

  1. customers are happy and can buy stuff
  2. clients make money
  3. cookies minimal

Actual result

  1. customers are unhappy

  2. clients are really unhappy

  3. cookies are a sogging mess
    depending on surfing habits there will be multiple ss_\d{8}* named cookies and multiple ls* cookies, possibly far too many depending on a variety of normal operating conditions.

  4. possibly get a "too many cookies" error

  5. possibly get a "request header too large" error

changing
https://github.com/julien-maurel/jQuery-Storage-API/blob/d2ce10b0fb53d7cb919f14e70853a5c232477f93/jquery.storageapi.js#L423
to be a static string instead of a random number for the window.name helps with the ss_* cookies
it will not help with the ls_* cookies

again, disabling localstorage here in firefox is just one example of causing the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Format is validGate 1 Passed. Automatic verification of issue format passed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions