Appearance
Security Audit: Banking & Anti-Fraud Defenses
Security Checklist
- Anti-IDOR Controls: Transfer queries explicitly verify
fromAccount.userId.equals(req.user._id), preventing attackers from initiating transfers from accounts they do not own. - Numeric Validation: Controller rejects negative values, zero amounts, non-numeric strings, and
NaN. - Self-Transfer Blocking: Prevents circular transfers where
fromAccountId === toAccountId. - Token Blacklisting: Revoked tokens are checked in MongoDB on every request.
- Ledger Immutability: Mongoose pre-hooks block
updateOne,deleteMany, andfindOneAndDeleteon the ledger collection.