endojs / endo

Endo is a distributed secure JavaScript sandbox, based on SES
Apache License 2.0
788 stars 70 forks source link

fix(compartment-mapper): fix ReadPowers-related types #2188

Open boneskull opened 4 months ago

boneskull commented 4 months ago

Description

This change:

  1. Creates a minimal interface for the fs, url, and crypto objects as passed into makeReadPowers(). This makes it easier to duck-type the objects. The drawback here is that it is not future-proof, and these types will need to be updated if we end up using additional methods on these objects.
  2. Fixes the invalid type of MaybeReadPowers; properties (defined thru @property) are ignored in a @typedef of that @typedef does not extend object/Object.
  3. Added necessary type assertion in powers.js
  4. Adds return type to makeReadPowersSloppy()

Upgrade Considerations

This is a type-only change.

boneskull commented 4 months ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @boneskull and the rest of your teammates on Graphite Graphite