Двигающий горами начинает с камешков (старая дзэнская поговорка)
Leo smiled. He opened a new terminal and manually reduced the three rows to one. Then he added a note to the user's account: "Loyal customer. Approved for second pair on next restock. Also, nice race condition."
for i in {1..3}; do curl -X POST https://velvetandsole.com/add-cart.php \ -d "product_id=DRN-7X&user_id=4421" & done Leo's fingers hovered over the keyboard. He could patch it. Add a unique key on (user_id, product_id) . Wrap the whole thing in a database transaction with SELECT ... FOR UPDATE . Deploy a rate limiter. He'd have it fixed by morning coffee. add-cart.php num
He closed the file. He'd fix add-cart.php tomorrow. Leo smiled
Instead, he clicked over to the user's profile. gh0st_walker had been a member for four years. Bought three pairs of boots, left glowing reviews each time. Their last order was a size 11—the same size in the ghost cart. Approved for second pair on next restock
The server logs didn't blink. They never did. But for Leo, the silent, green-on-black text of /var/log/nginx/access.log might as well have been a screaming headline.
Leo clicked through to the checkout table. The order hadn't been placed yet. But the cart's total? $1,197.00. The user had effectively bypassed the "max 1 per customer" rule without triggering a single alarm. Not a hack. Not an SQL injection. Just the ugly poetry of concurrency.
– 11:34:02.447 POST /add-cart.php HTTP/1.1 – 11:34:02.451 POST /add-cart.php HTTP/1.1 – 11:34:02.453