endojs / endo

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

feat: explicitly harden some shared prototypes #1939

Closed mhofman closed 10 months ago

mhofman commented 10 months ago

refs: #1914

Description

While working on #1686, I found out that some shared prototypes are currently hardened as a side effect of an instance being hardened. This PR adds explicit harden for these.

It also contains a small refactor to harden all intrinsics in one shot instead of multiple calls to harden, as there are cycles in those, and some intrinsics were effectively hardened in other calls.

Security Considerations

More explicit hardening brings more security

Scaling Considerations

None

Documentation Considerations

In Node.js, the Buffer and when the console is untamed, the internal SafeMap are now explicitly hardened. These would likely get hardened as side-effect of hardening instances before.

Testing Considerations

Tested in #1914 and https://github.com/Agoric/agoric-sdk/pull/8700 that these are all prototypes found through instances by existing tests. There may be others lurking, but until we have shallow hardening implemented, we won't find them.

Upgrade Considerations

This is a non breaking change that should be mostly unobservable to consumers.

mhofman commented 10 months ago

~Apparently some changes run before lockdown, back to drawing board~

Nope I'm an idiot, I forgot a line in my refactor