Three Checkboxes and $900 Million — JavaScript Bug Hunt
Modelled on Citibank's Revlon payment (August 2020): to send only an interest payment through the loan system, an operator had to tick three separate…
- Language: JavaScript
- Layer: Frontend
- Difficulty: Medium
- Concepts: Forms, Defaults
- Modelled on: Citibank · Revlon 2020
- Visible tests: no flags means interest only; a partial combination is refused; all three flags means a real payoff
- Reward: 50 XP for a complete fix
Incident
- Severity: SEV-1 (priority: Critical (funds))
- Ticket: BUG-REVLON
- Reported by: wire operations
- Time to fix: 20 minutes, the target for a medium incident
Failing checks on the shipped build
- a partial combination is refused — a half-configured payment must never escalate to the principal: expected {"kind":"refused","amount":0} but got {"kind":"principal","amount":894000000}
How to work this incident
- Read the report: write down the expected behaviour and the actual one in a sentence each.
- Reproduce it: run the visible tests and find the failing check that matches the report.
- Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
- Follow the value the screen shows back through the state and the pure helpers that compute it; the view is usually only the messenger.
- Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.
Briefing
Modelled on Citibank's Revlon payment (August 2020): to send only an interest payment through the loan system, an operator had to tick three separate checkboxes. Ticking one left the other two unset, and the system wired the entire $894 million principal instead. Much of it was never recovered.
payment.js decides what to send. Its defaults are dangerously permissive.
Fix buildPayment so an incompletely configured interest-only payment is refused rather than silently escalated to the full principal.
Bug report
BUG-REVLON · Priority: Critical (funds) · Reported by: wire operations
buildPayment(loan, flags) must return:
- { kind: "interest", amount: loan.interest } when flags.principal, flags.frontFund and flags.escrow are ALL false — the interest-only route
- { kind: "principal", amount: loan.principal } when all three are true
- { kind: "refused", amount: 0 } for any partial combination
Observed: a partial combination falls through to the principal branch and wires the whole loan.
Logs
[wire] kind=principal amount=894000000 flags={principal:false,frontFund:true,escrow:false}
[wire] operator intent recorded as: interest onlyThe code as shipped
src/payments/payment.js (editable)
// Decides which payment to send.
exports.buildPayment = function (loan, flags) {
if (!flags.principal && !flags.frontFund && !flags.escrow) {
return { kind: "interest", amount: loan.interest };
}
// Anything else is treated as a full principal payoff.
return { kind: "principal", amount: loan.principal };
};
Read-only context: src/payments/RUNBOOK.js.
Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More JavaScript bug hunts.