fix: cap wall flags and scene extra as opaque objects (#35)
One shared validator next to the property caps: 8 KB serialized, 64 keys per object, depth 8 (top-level object = 1). At a cap is accepted; over is invalid and applies nothing. Both call sites use it, and a refusal is logged once with the field and limit, never the value. Token flags and props keep their existing rules; stored over-cap rows still load as stored.
This commit is contained in:
+3
-1
@@ -32,7 +32,7 @@
|
||||
## no locking: the caller holds the global lock (4.3).
|
||||
import std/[json, math, options, strutils]
|
||||
import db_connector/db_sqlite
|
||||
import db, geometry, text
|
||||
import db, geometry, props, text
|
||||
|
||||
type
|
||||
WallPosition* = enum
|
||||
@@ -344,6 +344,8 @@ proc parseScenePatch*(node: JsonNode): Option[ScenePatch] =
|
||||
if node.hasKey("extra"):
|
||||
let v = node["extra"]
|
||||
if v.kind != JObject: return none(ScenePatch)
|
||||
# #35: the same opaque caps as wall `flags`; the contents stay uninterpreted.
|
||||
if checkOpaqueObject(v) != olOk: return none(ScenePatch)
|
||||
p.extra = some(v)
|
||||
any = true
|
||||
if not any: return none(ScenePatch)
|
||||
|
||||
Reference in New Issue
Block a user