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

@ -33,7 +33,7 @@ const MIME = {
'.txt': 'text/plain; charset=utf-8',
};
const CSP = "default-src 'self'; connect-src 'self' ws: wss:; img-src 'self' data:; " +
const CSP = "default-src 'self'; connect-src 'self'; img-src 'self' data:; " +
"style-src 'self' 'unsafe-inline'; media-src 'self' data:; base-uri 'none'; frame-ancestors 'none'";
// Headers every response carries (static files, /healthz, errors).
@ -124,6 +124,7 @@ function createStaticHandler(publicDir) {
}
return async function handle(req, res) {
applySecurityHeaders(res);
if (req.method !== 'GET' && req.method !== 'HEAD') {
return sendText(req, res, 405, 'Method Not Allowed', { Allow: 'GET, HEAD' });
}