[GH-ISSUE #566] Pixelforge: the stored brief is trusted raw on the load path — seal-time validation does not survive the round-trip #290

Closed
opened 2026-10-20 17:26:10 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kolacheee on GitHub (Aug 25, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/566

Originally assigned to: @kolacheee on GitHub.

Found while fixing #515 (probe-verified at every site named below): the sealed brief's validation is a seal-time guarantee that does not survive the round-trip through chat metadata — the load path trusts the stored brief raw.

The seam: PF.brief.validate has exactly three call sites, all inside 18-brief.js (the sealing flow). 60-save.js _configBrief returns meta.pixelforgeBrief as stored, and 20-world.js build() gates on shape only. So inside compile(), every one of brief.scale, brief.prosperity, brief.surround, feature.tag, place.kind, member.kind, member.tint, and the values of _ids.zones is an arbitrary stored string the validator's enum folding never touched.

Probe-verified consequences (driven through a real build() with prototype-named values planted in a stored brief):

  • prosperity: "constructor" → silent zone loss: 23 zones compile down to 7, with no degrade warning of any kind.
  • scale, place.kind, or _ids.zones values → silent legacy degradation: 23 zones become the 3-zone legacy layout (the world.build catch-all swallows the throw; only a console.warn marks it).
  • FURNISH["toString"] gets invoked unbound — the prototype method is called as a furnisher.

This is ~14 read sites but one defect: "a stored brief is trusted." Guarding each site individually would be exactly the whack-a-mole PF.own's comment (from #515's fix) disclaims — and would leave the root open for the next field someone adds to the brief.

Proposed fix, at the seam: re-validate on read — either _configBrief passes the stored object through PF.brief.validate before returning it (the validator already folds unknown enum values to defaults and records _repairs, so hostile fields heal instead of detonating downstream), or build()'s gate folds the enum fields explicitly. One call, every downstream read inherits the seal-time guarantee, and future brief fields are covered automatically.

Why it matters beyond hostile saves: the forward-compat path makes this reachable legitimately — a newer build that adds an enum value writes a brief an older build's compiler has never heard of, and today that older build silently loses zones or degrades to legacy rather than folding to a default. Same class as the envelope's version-floor design, unfinished on the brief's side.

Not a regression from #515 or 0.12 — the seam has been open since briefs started round-tripping. Contained today in that the degradation paths don't corrupt saves; the cost is silent world downgrades.

Originally created by @kolacheee on GitHub (Aug 25, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/566 Originally assigned to: @kolacheee on GitHub. Found while fixing #515 (probe-verified at every site named below): the sealed brief's validation is a **seal-time** guarantee that does not survive the round-trip through chat metadata — the load path trusts the stored brief raw. **The seam:** `PF.brief.validate` has exactly three call sites, all inside `18-brief.js` (the sealing flow). `60-save.js` `_configBrief` returns `meta.pixelforgeBrief` **as stored**, and `20-world.js` `build()` gates on shape only. So inside `compile()`, every one of `brief.scale`, `brief.prosperity`, `brief.surround`, `feature.tag`, `place.kind`, `member.kind`, `member.tint`, and the values of `_ids.zones` is an arbitrary stored string the validator's enum folding never touched. **Probe-verified consequences** (driven through a real `build()` with prototype-named values planted in a stored brief): - `prosperity: "constructor"` → **silent zone loss**: 23 zones compile down to 7, with no degrade warning of any kind. - `scale`, `place.kind`, or `_ids.zones` values → **silent legacy degradation**: 23 zones become the 3-zone legacy layout (the `world.build` catch-all swallows the throw; only a `console.warn` marks it). - `FURNISH["toString"]` gets **invoked unbound** — the prototype method is called as a furnisher. This is ~14 read sites but **one defect**: "a stored brief is trusted." Guarding each site individually would be exactly the whack-a-mole `PF.own`'s comment (from #515's fix) disclaims — and would leave the root open for the next field someone adds to the brief. **Proposed fix, at the seam:** re-validate on read — either `_configBrief` passes the stored object through `PF.brief.validate` before returning it (the validator already folds unknown enum values to defaults and records `_repairs`, so hostile fields heal instead of detonating downstream), or `build()`'s gate folds the enum fields explicitly. One call, every downstream read inherits the seal-time guarantee, and future brief fields are covered automatically. **Why it matters beyond hostile saves:** the forward-compat path makes this reachable legitimately — a newer build that adds an enum value writes a brief an older build's compiler has never heard of, and today that older build silently loses zones or degrades to legacy rather than folding to a default. Same class as the envelope's version-floor design, unfinished on the brief's side. Not a regression from #515 or 0.12 — the seam has been open since briefs started round-tripping. Contained today in that the degradation paths don't corrupt saves; the cost is silent world downgrades.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#290
No description provided.