← All sheets
GL-S-018Sheet 018RECORDS · SECURITY

Five bugs. Months apart. One bug.

NCR 001–005 · SAME ROOT CAUSE · ESSAY · MULTIVENDOR MARKETPLACE

Drawing sheet 018: Five bugs. Months apart. One bug.

General notes

  1. 01Five findings, different modules, different symptoms. Written up together they are one finding.
  2. 02A value was trusted where it could not be trusted: from the wrong party, or from a moment already gone.

Schedule of non-conformancesCaught in audit · none reached a customer

RefSymptomWhat was trustedFix
NCR 001Delivery fees inflatedThe rider's reported distanceServer-side haversine
NCR 002Stock went negativeA read that was already staleRow lock in one transaction
NCR 003Payouts driftedA commission field vendors could editAdmin-owned rate table
NCR 004Balances overdrawnA wallet read, then a writeLock the wallet row
NCR 005Refund could apply twiceRefund steps outside one transactionRefund inside a single transaction

As posted

Five findings. Months apart. Different modules, different symptoms, different fixes. Written up one at a time, they looked unrelated.

A rider's app reported a distance and the server billed on it. A stock check passed for two orders at once. A vendor's settings screen could write to the commission rate. A wallet was read, then written, by two requests in the same second. A refund ran as several steps that could stop halfway.

Written up together, they are one finding. In every case a value was trusted where it could not be trusted. Either it came from the party who benefited from it, or it came from a moment that had already passed by the time it was used.

That is the whole essay, really. The rest is the five stories, what each looked like from the inside, and the one habit that would have caught all five on day one: for every number in the system, ask who supplies it and when it was last true.

All five were caught in audit before they reached a customer. That is the part I am proud of. The part I am not proud of is how long the audit took to schedule.

Essay in the first comment. Sheet 018, non-conformance reports 001 to 005.

Long form: read the essay behind this sheet.

Read with

  • Sheet 003 · The rider billed 50 km. The trip was 2 km. Nothing crashed.
  • Sheet 006 · Two customers bought the last item. Both won. Stock: −1.
  • Sheet 011 · commission_rate: the field the vendor could edit.