[GH-ISSUE #567] Pixelforge: two more prototype-key sites (zone mount, maps-export bindings) #293

Closed
opened 2026-10-20 17:26:11 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @kolacheee on GitHub.

Two further prototype-key sites, found during the verification of the #515 fix and outside both #515's scope (they are not theme/name-table reads) and #566's (they are not brief fields). Both probe-verified; both latent today.

  1. packages/pixelforge/src/30-sim.js (~:82, the zone-mount early return) — if (!this.world.zones[zoneId]) return; on a plain {}. !zones["constructor"] is false, so the early return does not fire and Object's constructor function reaches the mount path. Latent because both current callers pre-validate their zone id — but teleport is a public method on PF.Sim, and 60-save.js already fixed this exact pattern with its hasZone helper.

  2. packages/pixelforge/src/55-maps-export.js (~:247-248) — if (world.bindings[locId] !== zoneId) { world.bindings[locId] = zoneId; changed = true; }. Assigning a string to bindings["__proto__"] is a silent no-op (the plain object's prototype setter eats it), so the inequality holds forever: a host location literally named __proto__ makes changed = true fire on every sync, permanently, and that zone never binds. Host location names arrive from outside the package, so unlike site 1 this one's key is genuinely externally influenced.

Fix shape: the PF.own(map, key) helper the #515 fix added to 00-prelude.js exists for exactly this — one read-guard per site (and for site 2, a write-guard or a null-prototype bindings map). Same class as the three prior gate catches the helper's comment enumerates.

Originally created by @kolacheee on GitHub (Aug 25, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/567 Originally assigned to: @kolacheee on GitHub. Two further prototype-key sites, found during the verification of the #515 fix and outside both #515's scope (they are not theme/name-table reads) and #566's (they are not brief fields). Both probe-verified; both latent today. 1. `packages/pixelforge/src/30-sim.js` (~:82, the zone-mount early return) — `if (!this.world.zones[zoneId]) return;` on a plain `{}`. `!zones["constructor"]` is `false`, so the early return does not fire and `Object`'s constructor function reaches the mount path. Latent because both current callers pre-validate their zone id — but `teleport` is a public method on `PF.Sim`, and `60-save.js` already fixed this exact pattern with its `hasZone` helper. 2. `packages/pixelforge/src/55-maps-export.js` (~:247-248) — `if (world.bindings[locId] !== zoneId) { world.bindings[locId] = zoneId; changed = true; }`. Assigning a string to `bindings["__proto__"]` is a silent no-op (the plain object's prototype setter eats it), so the inequality holds forever: a host location literally named `__proto__` makes `changed = true` fire on **every sync, permanently**, and that zone never binds. Host location names arrive from outside the package, so unlike site 1 this one's key is genuinely externally influenced. Fix shape: the `PF.own(map, key)` helper the #515 fix added to `00-prelude.js` exists for exactly this — one read-guard per site (and for site 2, a write-guard or a null-prototype `bindings` map). Same class as the three prior gate catches the helper's comment enumerates.
Author
Owner

@kolacheee commented on GitHub (Aug 25, 2026):

Correction to this issue's predicted mechanism, from the fix's implementation and independent verification (both reproduced it): the churn-at-the-write story is one step off.

Pre-fix, the write at the maps-export site is never reached with a "__proto__" key. The adoption read four lines earlier returns Object.prototype — neither undefined nor the zone — so the export refuses its own adoption on the very first sync and posts a permanent twin of the location onto the player's real map (the route is additive with no delete). The per-sync churn is real but lives at the other write into the same table: the first-sight seeding in the spatial layer, whose silent no-op leaves the bindings table empty forever — which also means the export never runs at all for a world whose root location carries that name.

Consequence: the site guard this issue proposed would have fixed neither observed symptom. The shipped fix (in #569, which now closes this issue) makes world.bindings a null-prototype map at creation instead — prototype-named locations bind and sync once like any other id, both symptoms and the predicted one close together, and old saves are covered by construction (restore copies into the built table rather than assigning over it).

<!-- gh-comment-id:5408475397 --> @kolacheee commented on GitHub (Aug 25, 2026): Correction to this issue's predicted mechanism, from the fix's implementation and independent verification (both reproduced it): the churn-at-the-write story is one step off. Pre-fix, the write at the maps-export site is **never reached** with a `"__proto__"` key. The adoption read four lines earlier returns `Object.prototype` — neither `undefined` nor the zone — so the export **refuses its own adoption on the very first sync and posts a permanent twin** of the location onto the player's real map (the route is additive with no delete). The per-sync churn is real but lives at the *other* write into the same table: the first-sight seeding in the spatial layer, whose silent no-op leaves the bindings table empty forever — which also means the export never runs at all for a world whose root location carries that name. Consequence: the site guard this issue proposed would have fixed **neither** observed symptom. The shipped fix (in #569, which now closes this issue) makes `world.bindings` a null-prototype map at creation instead — prototype-named locations bind and sync once like any other id, both symptoms and the predicted one close together, and old saves are covered by construction (restore copies into the built table rather than assigning over it).
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#293
No description provided.