fix(ocap-kernel): accept durable/virtual/faceted vrefs in isVRef#949
Open
fix(ocap-kernel): accept durable/virtual/faceted vrefs in isVRef#949
Conversation
The previous regex only matched plain `[op][+-]N`, rejecting liveslots-allocated durable-kind refs like `o+d10/1` and faceted forms like `o+d10/1:0`. Any vat using `defineDurableKind` would fail EndpointMessage validation on outgoing sends and reachable.ts on persisted-slot reads. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isVRefto match the full vref grammar produced by@agoric/swingset-liveslots'sparseVatSlot— durable (o+d10/1), virtual (o+v3/4), and faceted (o+d10/1:0) forms.^[op][+-]\d+$, which rejected any vat usingdefineDurableKind. The branding refactor in refactor(ocap-kernel): branded kernel identifiers with runtime validation #917 madeisVRefload-bearing throughEndpointMessageStruct,insistERef, andparseReachableAndVatSlot, so any vat using durable kinds would fail outgoing-send validation and persisted-slot reads. Existing kernel-internal tests didn't exercise this path; the bug surfaced when a vat in a downstream branch useddefineDurableKindfor a public facet and bootstrap died withnot a valid endpoint message.isKRefandisRRefare unchanged — kernel and remote allocators don't emit durability suffixes.Test plan
yarn workspace @metamask/ocap-kernel test(2341 passing locally)VatData.defineDurableKindfor its public facet now boots cleanly throughlaunchSubcluster(previously failed at the first outgoing eventual-send frombootstrap)🤖 Generated with Claude Code
Note
Medium Risk
Changes core reference validation (
isVRef/insistERef) used at RPC and message translation boundaries; a regex bug could either reject valid traffic or inadvertently accept malformed refs.Overview
Fixes vat reference validation to accept the full liveslots vref grammar, including durable (
o+d10/1), virtual (o+v3/4), and faceted (o+d10/1:0) object refs.Updates
isVRefto a stricter grammar-aware regex (only allowing durability/subid/facet syntax ono+), expands unit tests forisVRef/insistVRef/isERef/insistERef, and records the fix in the changelog to prevent endpoint message validation from breaking vats that use durable kinds.Reviewed by Cursor Bugbot for commit 9c1cffa. Bugbot is set up for automated code reviews on this repo. Configure here.