Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
327 stars 207 forks source link

fix(orchestration): harden exported patterns #10470

Closed erights closed 1 week ago

erights commented 1 week ago

closes: #XXXX refs: #XXXX

Description

orchestration/src/typeGuards was defining and exporting some patterns as just unhardened object literals. This is locally wrong, since these are not valid patterns (or even passables) until hardened. The only reason these errors were uncaught must be because they were then used in a context which happened to harden them before they were used in a context where they were validated as patterns or passables.

Started as a drive-by of #10456 , where I import some of these patterns for usage elsewhere.

Security Considerations

defensive hardening is good

Scaling Considerations

none

Documentation Considerations

one less thing we would need to explain

Testing Considerations

In theory, a test could have revealed the bug that these were exported unhardened. But IMO, such tests would only be too much noise. We should just fix these. But this PR only fixes these in this one file. I don't know how many others there are.

Upgrade Considerations

In theory, it is possible that some importing code somewhere accidentally replies on these being unhardened, perhaps because it mutates one in place before using it, corrupting use by all other importers. If so, this PR will break such uses, which is good, because the silent corruption is a worse surprise than a new noisy error.

cloudflare-workers-and-pages[bot] commented 1 week ago

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5943756
Status: ✅  Deploy successful!
Preview URL: https://1027f5b3.agoric-sdk.pages.dev
Branch Preview URL: https://markm-orch-type-guards.agoric-sdk.pages.dev

View logs