walls[].flags and scene.extra are accepted as arbitrary JSON objects with no size, depth or key-count cap. They are stored, re-sent in the GM's full scene view on every GM connect, and re-serialized on every scene write, so a single oversized object costs memory and bandwidth for the whole session. GM-only in v1, but the GM's own client sends it, so a bug or a pasted blob is enough.
Where
server/world.nim:114-118 — parseFlags: any JObject is accepted; only non-objects are invalid.
server/world.nim:174-178 — parseExtra path: same, any JObject accepted.
Reachable from wall.create/update and scene.set, whose values are rinsed to every GM connection.
Failure scenario
A wall carries a flags object with thousands of nested keys (or a pasted megabyte of junk). The write is acked; every subsequent GM connect re-sends it in full, and every scene.set round-trips it. Memory and frame size grow with the payload, tile/scene frames slow down, and there is no error to tell the GM which value is the problem. A per-connection frame cap may eventually reject the resync, leaving the GM unable to connect at all.
Confidence
High on the missing cap (there is no validation beyond "is an object"); the practical blast radius is bounded by GM trust.
Fix direction
Cap what the server will store and echo: a maximum serialized size for flags and extra (and, if nesting is allowed, a maximum depth and key count), answered as invalid beyond the cap, with the offending path named in the log. Keep the shape uninterpreted otherwise — the server still does not read the contents.
Acceptance
An oversized flags or extra is refused invalid and nothing is stored; a value at the cap is accepted.
Existing scenes and walls with small flags/extra round-trip byte-identically after a restart.
Regression test: a walls/scene test with an over-cap payload and a boundary-accepted payload.
## Summary
`walls[].flags` and `scene.extra` are accepted as arbitrary JSON objects with no size, depth or key-count cap. They are stored, re-sent in the GM's full scene view on every GM connect, and re-serialized on every scene write, so a single oversized object costs memory and bandwidth for the whole session. GM-only in v1, but the GM's own client sends it, so a bug or a pasted blob is enough.
## Where
- `server/world.nim:114-118` — `parseFlags`: any `JObject` is accepted; only non-objects are `invalid`.
- `server/world.nim:174-178` — `parseExtra` path: same, any `JObject` accepted.
- Reachable from `wall.create/update` and `scene.set`, whose values are rinsed to every GM connection.
## Failure scenario
A wall carries a flags object with thousands of nested keys (or a pasted megabyte of junk). The write is acked; every subsequent GM connect re-sends it in full, and every `scene.set` round-trips it. Memory and frame size grow with the payload, tile/scene frames slow down, and there is no error to tell the GM which value is the problem. A per-connection frame cap may eventually reject the resync, leaving the GM unable to connect at all.
## Confidence
High on the missing cap (there is no validation beyond "is an object"); the practical blast radius is bounded by GM trust.
## Fix direction
Cap what the server will store and echo: a maximum serialized size for `flags` and `extra` (and, if nesting is allowed, a maximum depth and key count), answered as `invalid` beyond the cap, with the offending path named in the log. Keep the shape uninterpreted otherwise — the server still does not read the contents.
## Acceptance
- An oversized `flags` or `extra` is refused `invalid` and nothing is stored; a value at the cap is accepted.
- Existing scenes and walls with small `flags`/`extra` round-trip byte-identically after a restart.
- Regression test: a `walls`/`scene` test with an over-cap payload and a boundary-accepted payload.
## Related
- #25 (slice 10: finish line).
- #2 (M3 planning map).
Category: enhancement Summary: cap wall flags and scene extra at 8 KB serialized, 64 keys per object and nesting depth 8, refusing anything larger as invalid
Current behavior:
A wall's flags and a scene's extra are accepted as any JSON object and stored verbatim. There is no size, key-count or depth limit — the only check is "is an object", and any other kind is already invalid. Both are echoed back in full: wall flags on every wall in the GM's scene payload and on every wall upsert, extra in the GM's hello, re-serialized on every write. A single oversized object therefore costs memory and bandwidth for the whole session: every GM connect re-sends it, every scene.set round-trips it, and a per-connection outbound cap (M5) could eventually refuse the resync and leave the GM unable to connect. There is also no error naming which value was too big — the write simply succeeds.
Desired behavior:
A value for wall flags or scene extra is accepted only if all three of these hold; otherwise the intent is refused invalid and nothing is stored:
serialized size ≤ 8 KB (8192 bytes of UTF-8 JSON as the server serializes it) — the same measure and the same number the property-value precedent already uses;
at most 64 keys per JSON object, applied to each object in the structure, not summed over the whole value;
nesting depth ≤ 8, where a top-level object is depth 1 and depth counts nested containers along any path.
At the cap is accepted; one byte, one key or one level over the cap is invalid. The boundary is inclusive on the accepted side and must be tested there, not just far away from it.
A refused write applies nothing: for wall.add/wall.update no wall row and no scene change; for scene.set none of the patch's other declared fields are applied either, since a patch is one intent.
The log names the offending field and which limit it broke (field name plus limit, never the value), at info/warn level through the existing structured log; no payload contents, no keys of the object.
Values within the caps keep round-tripping exactly as today: stored verbatim, byte-identical echo in the GM's frames, byte-identical after a restart. The server still never reads or interprets the contents — no schema, no allowed keys, no type checks inside.
The limits are identical for flags and extra; they are documented as one rule with two call sites, not two drifting copies.
Key interfaces:
DESIGN 6.1's wall payload rules and scene payload rules: each says the field is "a JSON object, stored verbatim and never interpreted"; both gain the three caps. Record the numbers — 8 KB, 64 keys per object, depth 8 — as an owner decision taken during #35's triage, alongside the property caps they mirror.
A single shared validator used by both payload parsers (wall flags and the scene patch's extra), so the two cannot diverge. It should measure size, key count and depth in one walk of the parsed JSON rather than three passes, and it should return the same "too big" indication for both call sites.
The named constants belong next to the existing property caps (the module that already defines the 8 KB value cap and the 64-key bucket cap) so all payload caps are read from one place, and the reuse is visible to a reader.
The existing invalid code is the only wire change: no new refusal code, no new field in the ack.
The same caps are a plausible later fit for token flags; do not apply them there in this issue, but keep the validator's shape reusable so that later change is a call site, not a rewrite.
Acceptance criteria:
Wall flags: a value exactly at 8 KB is accepted and echoed; 8 KB + 1 is refused invalid and nothing is stored.
Wall flags: an object with exactly 64 top-level keys is accepted; 65 is refused; the same holds for a nested object inside it (the cap is per object, not per value).
Wall flags: a value nested exactly 8 containers deep is accepted; 9 is refused.
Scene extra: the same three boundary pairs (size, key count including a nested object, depth), with the accepted side echoed in the GM's hello and the refused side invalid with no stored change.
A refused wall.update leaves the wall's previous flags intact; a refused wall.add creates no wall and consumes no wall id in a way that shows up as a gap in later ids.
A refused scene.set applies none of its other declared fields (name, radii, grid), and the scene row is unchanged.
Within-cap values round-trip byte-identically after a restart, for both fields.
The refusal is logged once, naming the field and the limit, with no value contents; the existing log-secret gate still passes.
DESIGN 6.1's wall and scene payload rules carry the three caps, marked as an owner decision from #35's triage.
A mutation that removes each check (size, key count, depth) fails at least one test.
Out of scope:
Any semantic validation of flags/extra contents (allowed keys, per-key types, schemas); the server keeps treating them as opaque.
Token flags, token/character props (already capped: 8 KB per value, 64 keys per bucket) and any change to those numbers.
Migrating or shrinking values already stored above the cap: an existing row is loaded and echoed as stored, so the GM can rewrite or remove it. The cap is an input rule, not a data migration.
Per-connection outbound frame caps and the M5 outbox.
Raising or lowering the scene's own numeric/name field limits (#4, #25 rules).
> *This was generated by AI during triage.*
## Agent Brief
**Category:** enhancement
**Summary:** cap wall `flags` and scene `extra` at 8 KB serialized, 64 keys per object and nesting depth 8, refusing anything larger as `invalid`
**Current behavior:**
A wall's `flags` and a scene's `extra` are accepted as any JSON object and stored verbatim. There is no size, key-count or depth limit — the only check is "is an object", and any other kind is already `invalid`. Both are echoed back in full: wall `flags` on every wall in the GM's scene payload and on every `wall` upsert, `extra` in the GM's `hello`, re-serialized on every write. A single oversized object therefore costs memory and bandwidth for the whole session: every GM connect re-sends it, every `scene.set` round-trips it, and a per-connection outbound cap (M5) could eventually refuse the resync and leave the GM unable to connect. There is also no error naming which value was too big — the write simply succeeds.
**Desired behavior:**
- A value for wall `flags` or scene `extra` is accepted only if all three of these hold; otherwise the intent is refused `invalid` and nothing is stored:
- **serialized size ≤ 8 KB** (8192 bytes of UTF-8 JSON as the server serializes it) — the same measure and the same number the property-value precedent already uses;
- **at most 64 keys per JSON object**, applied to each object in the structure, not summed over the whole value;
- **nesting depth ≤ 8**, where a top-level object is depth 1 and depth counts nested containers along any path.
- At the cap is accepted; one byte, one key or one level over the cap is `invalid`. The boundary is inclusive on the accepted side and must be tested there, not just far away from it.
- A refused write applies nothing: for `wall.add`/`wall.update` no wall row and no scene change; for `scene.set` none of the patch's other declared fields are applied either, since a patch is one intent.
- The log names the offending field and which limit it broke (field name plus limit, never the value), at info/warn level through the existing structured log; no payload contents, no keys of the object.
- Values within the caps keep round-tripping exactly as today: stored verbatim, byte-identical echo in the GM's frames, byte-identical after a restart. The server still never reads or interprets the contents — no schema, no allowed keys, no type checks inside.
- The limits are identical for `flags` and `extra`; they are documented as one rule with two call sites, not two drifting copies.
**Key interfaces:**
- **DESIGN 6.1's wall payload rules and scene payload rules**: each says the field is "a JSON object, stored verbatim and never interpreted"; both gain the three caps. Record the numbers — 8 KB, 64 keys per object, depth 8 — as an owner decision taken during #35's triage, alongside the property caps they mirror.
- **A single shared validator** used by both payload parsers (wall `flags` and the scene patch's `extra`), so the two cannot diverge. It should measure size, key count and depth in one walk of the parsed JSON rather than three passes, and it should return the same "too big" indication for both call sites.
- **The named constants** belong next to the existing property caps (the module that already defines the 8 KB value cap and the 64-key bucket cap) so all payload caps are read from one place, and the reuse is visible to a reader.
- **The existing `invalid` code** is the only wire change: no new refusal code, no new field in the ack.
- The same caps are a plausible later fit for token `flags`; do not apply them there in this issue, but keep the validator's shape reusable so that later change is a call site, not a rewrite.
**Acceptance criteria:**
- [ ] Wall `flags`: a value exactly at 8 KB is accepted and echoed; 8 KB + 1 is refused `invalid` and nothing is stored.
- [ ] Wall `flags`: an object with exactly 64 top-level keys is accepted; 65 is refused; the same holds for a nested object inside it (the cap is per object, not per value).
- [ ] Wall `flags`: a value nested exactly 8 containers deep is accepted; 9 is refused.
- [ ] Scene `extra`: the same three boundary pairs (size, key count including a nested object, depth), with the accepted side echoed in the GM's `hello` and the refused side `invalid` with no stored change.
- [ ] A refused `wall.update` leaves the wall's previous `flags` intact; a refused `wall.add` creates no wall and consumes no wall id in a way that shows up as a gap in later ids.
- [ ] A refused `scene.set` applies none of its other declared fields (name, radii, grid), and the scene row is unchanged.
- [ ] Within-cap values round-trip byte-identically after a restart, for both fields.
- [ ] The refusal is logged once, naming the field and the limit, with no value contents; the existing log-secret gate still passes.
- [ ] DESIGN 6.1's wall and scene payload rules carry the three caps, marked as an owner decision from #35's triage.
- [ ] A mutation that removes each check (size, key count, depth) fails at least one test.
**Out of scope:**
- Any semantic validation of `flags`/`extra` contents (allowed keys, per-key types, schemas); the server keeps treating them as opaque.
- Token `flags`, token/character `props` (already capped: 8 KB per value, 64 keys per bucket) and any change to those numbers.
- Migrating or shrinking values already stored above the cap: an existing row is loaded and echoed as stored, so the GM can rewrite or remove it. The cap is an input rule, not a data migration.
- Per-connection outbound frame caps and the M5 outbox.
- Raising or lowering the scene's own numeric/name field limits (#4, #25 rules).
Fixed in b0e1633 (fix: cap wall flags and scene extra as opaque objects (#35)), pushed to main.
Cause:parseFlags and the scene extra path accepted any JObject verbatim; no size, key or depth bound, so one pasted blob was stored and echoed on every GM connect.
Fix: one shared validator in server/props.nim, next to the existing property caps, used by both call sites: serialized JSON <= 8 KB, <= 64 keys per object (per object, not summed), nesting depth <= 8 (top-level object = 1). At a cap is accepted; one byte/key/level over is invalid and applies nothing. Refusals log one opaque_refused field=... limit=... event with no contents. Token flags and props keep their existing rules; over-cap rows already stored still load as stored. DESIGN 6.1 carries the three caps as [FIXED (owner-delegated, 2026-11-20, #35)] and DESIGN-history records the decision.
Proof:tests/tprops.nim boundary pairs for size/keys/depth (including per-object and array depth); black-box tools/walls.test.mjs and tools/scene.test.mjs cover accepted-at-cap echo, refused adds (no wall, no id gap), refused update preserving old flags, refused scene patch applying no other field, and the log line; mutation entries f1/f2/f3 remove each cap. Full nimble test -y and Node suite (149/149) green after rebase.
Fixed in b0e1633 (`fix: cap wall flags and scene extra as opaque objects (#35)`), pushed to `main`.
**Cause:** `parseFlags` and the scene `extra` path accepted any `JObject` verbatim; no size, key or depth bound, so one pasted blob was stored and echoed on every GM connect.
**Fix:** one shared validator in `server/props.nim`, next to the existing property caps, used by both call sites: serialized JSON <= 8 KB, <= 64 keys per object (per object, not summed), nesting depth <= 8 (top-level object = 1). At a cap is accepted; one byte/key/level over is `invalid` and applies nothing. Refusals log one `opaque_refused field=... limit=...` event with no contents. Token `flags` and props keep their existing rules; over-cap rows already stored still load as stored. DESIGN 6.1 carries the three caps as [FIXED (owner-delegated, 2026-11-20, #35)] and DESIGN-history records the decision.
**Proof:** `tests/tprops.nim` boundary pairs for size/keys/depth (including per-object and array depth); black-box `tools/walls.test.mjs` and `tools/scene.test.mjs` cover accepted-at-cap echo, refused adds (no wall, no id gap), refused update preserving old flags, refused scene patch applying no other field, and the log line; mutation entries f1/f2/f3 remove each cap. Full `nimble test -y` and Node suite (149/149) green after rebase.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
walls[].flagsandscene.extraare accepted as arbitrary JSON objects with no size, depth or key-count cap. They are stored, re-sent in the GM's full scene view on every GM connect, and re-serialized on every scene write, so a single oversized object costs memory and bandwidth for the whole session. GM-only in v1, but the GM's own client sends it, so a bug or a pasted blob is enough.Where
server/world.nim:114-118—parseFlags: anyJObjectis accepted; only non-objects areinvalid.server/world.nim:174-178—parseExtrapath: same, anyJObjectaccepted.wall.create/updateandscene.set, whose values are rinsed to every GM connection.Failure scenario
A wall carries a flags object with thousands of nested keys (or a pasted megabyte of junk). The write is acked; every subsequent GM connect re-sends it in full, and every
scene.setround-trips it. Memory and frame size grow with the payload, tile/scene frames slow down, and there is no error to tell the GM which value is the problem. A per-connection frame cap may eventually reject the resync, leaving the GM unable to connect at all.Confidence
High on the missing cap (there is no validation beyond "is an object"); the practical blast radius is bounded by GM trust.
Fix direction
Cap what the server will store and echo: a maximum serialized size for
flagsandextra(and, if nesting is allowed, a maximum depth and key count), answered asinvalidbeyond the cap, with the offending path named in the log. Keep the shape uninterpreted otherwise — the server still does not read the contents.Acceptance
flagsorextrais refusedinvalidand nothing is stored; a value at the cap is accepted.flags/extraround-trip byte-identically after a restart.walls/scenetest with an over-cap payload and a boundary-accepted payload.Related
Agent Brief
Category: enhancement
Summary: cap wall
flagsand sceneextraat 8 KB serialized, 64 keys per object and nesting depth 8, refusing anything larger asinvalidCurrent behavior:
A wall's
flagsand a scene'sextraare accepted as any JSON object and stored verbatim. There is no size, key-count or depth limit — the only check is "is an object", and any other kind is alreadyinvalid. Both are echoed back in full: wallflagson every wall in the GM's scene payload and on everywallupsert,extrain the GM'shello, re-serialized on every write. A single oversized object therefore costs memory and bandwidth for the whole session: every GM connect re-sends it, everyscene.setround-trips it, and a per-connection outbound cap (M5) could eventually refuse the resync and leave the GM unable to connect. There is also no error naming which value was too big — the write simply succeeds.Desired behavior:
flagsor sceneextrais accepted only if all three of these hold; otherwise the intent is refusedinvalidand nothing is stored:invalid. The boundary is inclusive on the accepted side and must be tested there, not just far away from it.wall.add/wall.updateno wall row and no scene change; forscene.setnone of the patch's other declared fields are applied either, since a patch is one intent.flagsandextra; they are documented as one rule with two call sites, not two drifting copies.Key interfaces:
flagsand the scene patch'sextra), so the two cannot diverge. It should measure size, key count and depth in one walk of the parsed JSON rather than three passes, and it should return the same "too big" indication for both call sites.invalidcode is the only wire change: no new refusal code, no new field in the ack.flags; do not apply them there in this issue, but keep the validator's shape reusable so that later change is a call site, not a rewrite.Acceptance criteria:
flags: a value exactly at 8 KB is accepted and echoed; 8 KB + 1 is refusedinvalidand nothing is stored.flags: an object with exactly 64 top-level keys is accepted; 65 is refused; the same holds for a nested object inside it (the cap is per object, not per value).flags: a value nested exactly 8 containers deep is accepted; 9 is refused.extra: the same three boundary pairs (size, key count including a nested object, depth), with the accepted side echoed in the GM'shelloand the refused sideinvalidwith no stored change.wall.updateleaves the wall's previousflagsintact; a refusedwall.addcreates no wall and consumes no wall id in a way that shows up as a gap in later ids.scene.setapplies none of its other declared fields (name, radii, grid), and the scene row is unchanged.Out of scope:
flags/extracontents (allowed keys, per-key types, schemas); the server keeps treating them as opaque.flags, token/characterprops(already capped: 8 KB per value, 64 keys per bucket) and any change to those numbers.Fixed in
b0e1633(fix: cap wall flags and scene extra as opaque objects (#35)), pushed tomain.Cause:
parseFlagsand the sceneextrapath accepted anyJObjectverbatim; no size, key or depth bound, so one pasted blob was stored and echoed on every GM connect.Fix: one shared validator in
server/props.nim, next to the existing property caps, used by both call sites: serialized JSON <= 8 KB, <= 64 keys per object (per object, not summed), nesting depth <= 8 (top-level object = 1). At a cap is accepted; one byte/key/level over isinvalidand applies nothing. Refusals log oneopaque_refused field=... limit=...event with no contents. Tokenflagsand props keep their existing rules; over-cap rows already stored still load as stored. DESIGN 6.1 carries the three caps as [FIXED (owner-delegated, 2026-11-20, #35)] and DESIGN-history records the decision.Proof:
tests/tprops.nimboundary pairs for size/keys/depth (including per-object and array depth); black-boxtools/walls.test.mjsandtools/scene.test.mjscover accepted-at-cap echo, refused adds (no wall, no id gap), refused update preserving old flags, refused scene patch applying no other field, and the log line; mutation entries f1/f2/f3 remove each cap. Fullnimble test -yand Node suite (149/149) green after rebase.