Client validation bypassed
Review this Python checkout endpoint. The team says 'the React form already validates quantity and price before submit.'
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.
0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1@app.post('/cart/checkout')
2def checkout():
3 body = request.get_json()
4 total = 0
5 for item in body['items']:
6 # price and qty validated in the browser form
7 total += item['price'] * item['quantity']
8 order = create_order(user_id(), items=body['items'], total=total)
9 charge(user_id(), total)
10 return jsonify({'order_id': order.id})
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.