endojs / endo

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

feat(compartment-mapper): Collect unused module descriptors #2614

Closed kriskowal closed 1 month ago

kriskowal commented 1 month ago

Closes: #2313

Description

This change adds instrumentation to the compartment mapper that allows it to omit module descriptors from archive compartment maps if they’re not needed to link the archived application.

Security Considerations

None.

Scaling Considerations

Should reduce bundle sizes.

Documentation Considerations

Does not merit attention and one less surprise for bundle size investigators. Noted in NEWS.

Testing Considerations

This change augments the existing test for compartment retention to cover module descriptor collection.

Compatibility Considerations

The change does not add the "retained" property to archived compartment-map.json, so new bundles should remain compatible with older versions of checkBundle. However, I relaxed the schema validator to get an unrelated test for captureCompartmentMap passing, so future deployments of checkBundle will be more lenient.

Upgrade Considerations

Should not affect upgrades.