You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following code snippet, the parameter quantity is unchecked, meaning an attacker can inject a negative quantity into the request. This results in the cart being updated with a negative value which can be seen in the picture below.
consthandleAddToCart=async(productId,quantity)=>{if(quantity>0){constitem=awaitcommerce.cart.add(productId,quantity);setCart(item.cart);}else{// throw some error}};
The text was updated successfully, but these errors were encountered:
In the following code snippet, the parameter quantity is unchecked, meaning an attacker can inject a negative quantity into the request. This results in the cart being updated with a negative value which can be seen in the picture below.
A simple fix could be
The text was updated successfully, but these errors were encountered: