Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compartment-mapper): extract some useful functions [DRAFT] #2017

Closed
wants to merge 3 commits into from

Conversation

boneskull
Copy link
Contributor

This is supposed to enable LavaMoat to piggyback on @endo/compartment-mapper for its own policy generation.

WIP. Do not even look

@boneskull boneskull self-assigned this Jan 30, 2024
@boneskull boneskull force-pushed the boneskull/enable-archive-resolution branch 2 times, most recently from 007db3d to 6e54a49 Compare February 22, 2024 22:46
@boneskull boneskull force-pushed the boneskull/enable-archive-resolution branch from 6e54a49 to 6988256 Compare February 27, 2024 02:04
@boneskull
Copy link
Contributor Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@boneskull boneskull force-pushed the boneskull/enable-archive-resolution branch 2 times, most recently from 5282ed2 to c23e271 Compare March 26, 2024 22:09
The `extraParsers` option is an optional mapping of file extension to parser name.  Consumers can use it to associate a file extension with a specific parser, e.g., `{"node": "bytes"}` or override the default mappings.

The specific use-case is enabling creation of compartment map descriptors for Node.js native modules (e.g., `index.node`) _without_ needing a `parsers: {node: 'bytes'}` property in the `package.json` of the package containing the native module.
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.
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()`
@boneskull boneskull force-pushed the boneskull/enable-archive-resolution branch from c23e271 to 629398b Compare March 27, 2024 20:14
@boneskull
Copy link
Contributor Author

closing in lieu of #2188, #2189, #2190

@boneskull boneskull closed this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant