Skip to content

Conversation

@boneskull
Copy link
Member

I am iterating on this, but Claude has already made some things more clear.

@boneskull boneskull self-assigned this Jan 9, 2026
@boneskull boneskull added the documentation Improvements or additions to documentation label Jan 9, 2026
@boneskull boneskull force-pushed the boneskull/compartment-mapper-architecture branch from f95cad8 to 297fa12 Compare January 10, 2026 00:18
I am iterating on this, but Claude has already made some things more clear.
@boneskull boneskull force-pushed the boneskull/compartment-mapper-architecture branch from 297fa12 to c5883fe Compare January 10, 2026 00:29
Copy link
Member

@kriskowal kriskowal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only had a moment to look and leave some comments. Thanks for sharing the draft.

@@ -0,0 +1,1365 @@
# Compartment Mapper Architecture

This document provides a comprehensive technical analysis of `@endo/compartment-mapper`, a package that enables secure, sandboxed execution of Node.js-style applications using the SES (Secure ECMAScript) `Compartment` abstraction.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SES (HardenedJS)

3. **Links** compartments together, allowing controlled module sharing
4. **Executes** or **archives** applications in a sandboxed environment

This enables the _Principle of Least Authority (POLA)_: each package runs with only the capabilities explicitly granted to it, mitigating prototype pollution and supply chain attacks.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In combination with a trust-on-first-use policy,

Otherwise, it simply enables us to bundle node_modules applications deterministically such that they can collectively run in a guest sandbox with packages in separate compartments.

It will eventually allow us to bundle applications as a ZIP of original sources, eschewing source modification entirely, improving the debugging experience of sandboxed applications anywhere.


### What is a Compartment?

A **Compartment** (from the SES proposal) is an isolated JavaScript execution environment with:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the compartments proposal, https://github.com/endojs/proposal-compartments


This enables the _Principle of Least Authority (POLA)_: each package runs with only the capabilities explicitly granted to it, mitigating prototype pollution and supply chain attacks.

### What is a Compartment?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to move this into its own related document since some of this detail exceeds the needs of the context but would be useful nonetheless. In particular, a rigorous account of the SES frozen intrinsics would be good to have somewhere.

Comment on lines +712 to +720
sequenceDiagram
participant User
participant Archive as archive.js
participant NodeModules as node-modules.js
participant ArchiveLite as archive-lite.js
participant Linker as link.js
participant Zip as @endo/zip

Note over User,Zip: Archive Creation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m adding a note to CONTRIBUTING.md that should convince folks to use 2 space indents in these Mermaid diagrams consistently.

@@ -0,0 +1,1365 @@
# Compartment Mapper Architecture

This document provides a comprehensive technical analysis of `@endo/compartment-mapper`, a package that enables secure, sandboxed execution of Node.js-style applications using the SES (Secure ECMAScript) `Compartment` abstraction.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ensure that this uses the voice of authority on the architecture rather than a post-hoc analysis before it lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants