Skip to content

Pin the vat endowment behaviours we depend on with a conformance test #1000

Description

@sirtimid

packages/ocap-kernel/src/vats/endowments.ts relies on specific behavioural properties of buildCommonEndowments from @metamask/snaps-execution-environments:

  • Date is attenuated such that a vat cannot read real wall-clock time unless endowed
  • Math.random is substituted rather than passed through
  • timer factories are isolated per vat and support teardown
  • fetch is tearable-down, and only reaches hosts we allow

Nothing on our side asserts any of these. They are upstream implementation details that we treat as kernel guarantees. A change made for entirely sensible wallet reasons could weaken one of them, and we would not find out — our tests would still pass, because none of them test this.

Proposed: a conformance test in ocap-kernel that launches a vat and asserts the properties we actually depend on. Not testing the upstream implementation — testing our assumptions about it, so that if a version bump changes one, CI tells us instead of a reviewer discovering it later. This is our job regardless of who maintains the endowments.

It also gives us something concrete to hand a security reviewer asking "how do you know a vat cannot observe time or reach the network", which is currently answered by reading two packages.

Related: #1002 (deterministic vat profile) — this conformance test is most of what that profile needs in order to be verifiable rather than asserted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions