Fix review findings: proto smuggling, trade-leg recall, escrow cap, static headers, rate limits, rankings DoS

Fixed: validator rejects __proto__/constructor keys at any depth (transport capacity bypass); trade and site shipments
cannot be recalled; trade escrow refund capped by Rack hall; CSP/nosniff on static files and connect-src 'self';
IPv6 /64 limiter keys + LRU eviction + per-username login bucket + scrypt concurrency cap; 5 s footprint cache for
rankings; rename uses text.cleanText; 429s no longer pinned in the idempotency store; 30-day notification prune;
units_offline notification on first offline. Accepted items listed in docs/DECISIONS.md R1.
Tested: npm test 182/182 incl. test/review-fixes.test.js (regression tests). Not re-reviewed after the fixes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
jvanvik 2026-10-11 19:06:51 +02:00
parent b18645dca1
commit d84b0c9d12
11 changed files with 190 additions and 17 deletions

View file

@ -46,6 +46,8 @@ function reschedule(ctx, townId, now) {
if (!row || row.offline_since === null) {
db.run('INSERT INTO town_power (town_id, offline_since) VALUES (?, ?) ON CONFLICT (town_id) DO UPDATE SET offline_since = excluded.offline_since', townId, now);
row = { offline_since: now };
const uid = U.userOfOperator(db, town.ownerId);
if (uid) ctx.notify(uid, town.worldId, 'units_offline', { townId, since: now });
}
ctx.enqueue({ worldId: town.worldId, dueAt: Math.max(now, row.offline_since + R.decommissionMs(town.speed)), type: 'powerCheck', townId, payload: { townId } });
}