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:
parent
b18645dca1
commit
d84b0c9d12
11 changed files with 190 additions and 17 deletions
|
|
@ -2,12 +2,12 @@
|
|||
const { GameError } = require('../errors');
|
||||
const { ownedTown } = require('./build');
|
||||
|
||||
const STRIP = new RegExp('[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069\\ufeff]', 'g');
|
||||
const { cleanText } = require('../text');
|
||||
|
||||
// Display-name hygiene: no control or bidi characters, collapsed whitespace, 2..24 characters.
|
||||
// Display-name hygiene (same rules as every other player-typed text): no control/bidi/invisible characters,
|
||||
// collapsed whitespace, at most 24 characters.
|
||||
function cleanName(v) {
|
||||
const s = Array.from(String(v).replace(STRIP, '').replace(/\s+/g, ' ').trim()).slice(0, 24).join('').trim();
|
||||
return s;
|
||||
return Array.from(cleanText(v)).slice(0, 24).join('').trim();
|
||||
}
|
||||
|
||||
module.exports = function renameTown(ctx, { userId, townId, name }) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue