Skip to content

removeItemFromCart mutation modifies cart without authorization #36809

Open
@brettlaishley

Description

@brettlaishley

Preconditions and environment

  • Magento version 2.4.5-p1

Steps to reproduce

  1. From browser and Magento instance
  2. Create customer and login
  3. Add any product to cart
  4. Swap to graphql/altair/postman
  5. Use generateCustomerToken mutation to create graphql authorization token
  6. Use customerCart query with the authorization token to retrieve details of the user's current cart
  7. Take note of the cart_id and cart_item_id
  8. Use 'removeItemFromCart` mutation without the authorization token to remove the item from the cart (error received)
  9. Return to browser and Magento instance
  10. Refresh page to see that supposedly no changes have been made to the cart
  11. Add another product to the cart to trigger a more thorough update

Expected result

The cart should have 2 products in it. The 3rd unauthorized mutation should not modify the user's cart. An authorization token should always be required to modify a signed in user's cart.

Actual result

The cart item is removed from the user's cart upon a more thorough cart update from the browser Luma storefront. The removeItemFromCart mutation without an authorization token was still able to modify the user's cart.

Even though the message returned from the API says the "user cannot perform operations on the cart" because the authorization token is not supplied, in the background the item has been removed from the cart.

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions