A review of the current state, done by reading the code and running it, not a list of intentions. It includes what is still wrong. This does not replace an external audit or a testing laboratory's certification. It is what a developer can assert about their own code, with the evidence alongside.
Spanish version: AUDIT.es.md.
| HTTP endpoints | 17, all reviewed |
| Dependency vulnerabilities | 3 high (backend), 0 (frontend) |
| Automated tests | 142, several against a real database |
| Secrets in the repository | none |
Money. Integers in minor units, never floating point. Every balance movement is accompanied by its ledger entry inside the same transaction, and the debit is conditioned in the SQL statement itself (WHERE balance >= importe), so it is the database — not a prior read — that prevents double spending. There is a report that checks each player's balance against the sum of their movements, and there are tests that break the accounting on purpose to verify that the detector detects.
Idempotency. Every movement carries a unique reference with a unique index in the database. A retry does not charge twice. Tested against real PostgreSQL, not a mock: what upholds the guarantee is the index, and a mock would only prove that the mock is idempotent.
Authentication. Startup aborts if JWT_SECRET is missing; there is no default secret. Operator endpoints require ADMIN_KEY and answer 404 — not 403 — whether the key is missing or wrong, so as not to confirm that they exist.
Input. slot is bounded to 1 or 2; chat is truncated to 150 characters and passed through a filter; amounts are validated against the currency's limits; client seeds that fail the filter are replaced with a server-side one rather than rejecting the bet.
SQL. Every query goes through Prisma or parameterised templates. No SQL is built by concatenating text.
Rate limits. 120 requests per minute per IP over HTTP, reading X-Forwarded-For so that everything behind the proxy does not count as one. The expensive endpoint (/rounds, up to 500 rows with seeds) is tighter, at 12 per minute.
Development surface closed. /dev/shot only exists if explicitly requested with a variable. It used to depend on NODE_ENV not being production — and NODE_ENV is not defined on Render, so it was left open in production: an unauthenticated POST that wrote up to 12 MB to disk from any origin.
They are in the Prisma CLI chain (prisma → @prisma/config → deepmerge-ts): stack exhaustion when merging recursive objects. Fixing them requires a major version bump of Prisma.
Real risk: low. That code runs at deploy time (prisma migrate deploy) over our own configuration file, not in the engine serving player requests. There is no attacker input that reaches it.
Not fixed. It gets fixed when Prisma's next major version is due anyway.
The known gap in the provably fair scheme, documented also in FAIRNESS.md: whoever controls the server can take part in rounds to influence the client seed. The pre-committed chain and the Bitcoin salt prevent choosing the sequence in advance, but not this.
Reduced, not closed. Commit-reveal is in: bets commit to sha256(seed) while betting is open and reveal only after it closes, which removes the unbounded grind — at commit time there is nothing to evaluate but other people's hashes. Against a player it is closed outright. Against an operator running the server, one bit survives: reveal its own seed, or stay quiet, having watched everyone else's arrive. Every commitment is public from the moment the bet is placed and is stored beside what it revealed, so using that bit repeatedly shows up in the history. Closing it entirely would need reveals a server can enforce against itself, which is why FAIRNESS.md reports the bit rather than claiming it away.
Neither X-Frame-Options nor frame-ancestors is sent, on purpose: a casino game lives inside the operator's iframe and forbidding framing would break its only mode of use. Who may frame it is the operator's decision under their own policy, and that arrives with the integration.
Until then, the public demo can be framed by anyone.
/api/guest creates an account with demo balance, limited to 12 per minute per IP. That is correct for a demo with play money and must not exist in production with an operator: there, the player and their balance belong to the casino.
Round state lives in memory. A restart mid-round no longer loses money — stakes are refunded automatically on startup, see WALLET.md — but the game does not scale horizontally: two nodes would play two different rounds.
Confirming a bet with 600 players took 5.4 seconds. It is not a security fault, but it was an operational limit.
Improved. Bet writes are now batched — one transaction per batch instead of one per bet — and the write path went from 241 ms to 17 ms for 600 concurrent bets, measured in isolation. What is not yet re-measured is the end-to-end figure a player would feel; the 5.4 s stands in LOAD.md until it is measured on a machine that is not also running the test client.
Stakes, profits and ledger entries are Int columns: nothing above 2,147,483,647 minor units can be stored. Until 17 September 2026 the default max win in three currencies was above that (45 million rupees, 50 million Argentine pesos, 750 million naira), so a win of that size would have failed to save and left the round unsettled.
Fixed for limits. Those caps now sit at 2,000 million minor units, and any limit, including one set by the operator through the environment, is clamped to the column ceiling. A test checks every currency against it.
Still open. A player balance above the ceiling — about 21 million units of a high-denomination currency — would still not fit. Raising the ceiling means moving these columns to BigInt, which has not been done.
cd backend && npm test # 135 tests
npm audit --omit=dev # dependencies
The money tests run one at a time against a real database: in parallel they shared the database, and the integrity report, which reads global state, saw the mismatches another file was causing on purpose. A money test that sometimes passes is worse than not having one.