Skip to content

Fix #1987: A forged VERB_PROJECTION mark lets a plugin delete a neighbour's command through VerbRegistry.unregister - #1995

Open
philcunliffe wants to merge 1 commit into
masterfrom
fix/issue-1987
Open

philcunliffe wants to merge 1 commit into
masterfrom
fix/issue-1987

Conversation

@philcunliffe

Copy link
Copy Markdown
Contributor

Feature or issue

A plugin could lift the VERB_PROJECTION symbol off a live command record with Object.getOwnPropertySymbols, stamp it onto a record it does not own, squat a verb of that name and release it, and retractCommand deleted what then read as its own projection: measured through the real dispatch(), the forge removed a neighbour's acme sync and core's status, after which the squatter registered both names and its bodies ran (issue #1987). This was the second and last spelling of issue #1980; PR #1988 closed the direct route, so both issues close here.

Solution

  • retractCommand now requires a second, kernel-recorded fact besides the mark: the released verb's recorded registrar (read before its ledger entry is deleted) must equal CommandRegistry.ownerOf(name). Both bindings are written only inside registeringAs brackets, so no plugin write can move a name from one answer to the other; a mismatch warns (verb.retract.registrar_mismatch) and refuses.
  • Core retracting core, and the LLP 0264 #verb host displacement, compare undefined === undefined and keep working; a host-injected registry without ownerOf retracts on the mark alone, the tolerance the surrounding branches already extend. LLP 0427 records the revisit of the "forging it buys nothing" premise that LLP 0424 #consequences called for.
  • Regression tests drive the real dispatch() for both measured victims (fail before, pass after), plus a plugin releasing its own verb (aliases retracted with it) and core retracting core.

CPU and memory pass: one Map.get and one ownerOf lookup per verb release, and releases are rare; nothing per-record or per-dispatch, no allocation outside the refusal path, no growth with data volume or uptime. No CPU or memory concern.

Code: +62 / -17 lines

Fixes #1987
Fixes #1980

…e delete a neighbour's or a core command (issue #1987)

retractCommand routed a deletion on isVerbProjection(commandRegistry.get(name))
alone, and the mark that test reads is an enumerable symbol on a record
ctx.commands.get hands back live: a plugin lifted it off a real projection with
Object.getOwnPropertySymbols, stamped it onto a neighbour's command, squatted a
verb of that name (no projection is made, the name is taken) and released it,
and the kernel deleted the neighbour's command for it. Measured through the
real dispatch(): the same lines took 'acme sync' and 'status' off the registry,
after which the squatter registered both names and its bodies ran.

Retraction now requires a second fact the kernel recorded: the released verb's
registrar, read before its ledger entry is deleted, has to agree with
CommandRegistry.ownerOf(name). Both bindings are written only inside
registeringAs brackets, so no plugin write moves a name from one answer to the
other. The mark stays, answering what the command is (a projection, not a
plugin command sharing the name); the per-registry projection ledger LLP 0264
paragraph-verb refuses is still not kept, because core retracting core and the host
displacement path compare undefined === undefined and keep working. A command
registry without ownerOf (a host's own, injected) retracts on the mark alone,
the tolerance the surrounding branches already extend, and the refusing branch
warns (verb.retract.registrar_mismatch) like the tolerated ones do.

LLP 0427, extending LLP 0424 #consequences, records the revisit of the
"forging it buys nothing" premise that bullet called for.

This is the second and last spelling of issue #1980: PR #1988 closed the
direct route, and the forge was the one route that survived it.

Fixes #1987
Fixes #1980

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant