Skip to main content

Practice ยท 1 of 2

Own the object check

Implement get_order(session, order_id, admin=False) with NotFound/Forbidden exceptions and the module-level ORDERS dict (owners 'alice' and 'bob'): - unknown id โ†’ NotFound('no such order') - admin=True โ†’ any order - owner (from session['user']) โ†’ their order - everyone else โ†’ **NotFound('no such order')** โ€” never Forbidden and never the data: a 404 doesn't confirm the resource exists (no enumeration oracle) - the check must use the session user only; a client-supplied as_user key must be IGNORED This is IDOR as executable specification.

Difficulty: advanced

Back to lesson: Practice: Authorization & Session Drills