Spot the bug in the order reader

from API security
Node 24 intermediate 4 min 1 issue to find

Find the security bug in this generated order reader.

JavaScript
async function getOrder(request, db) {
  const principal = await authenticate(request.headers.authorization);
  const order = await db.orders.find(request.params.orderId);
  if (!order) return { status: 404 };
  return { status: 200, body: order };
}
Open in playground
Report an error