Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0fa26f1
feat(ses): Sense @endo/harden usage before lockdown
kriskowal Oct 1, 2025
cc39fc1
chore(harden): Create from scaffold
kriskowal Sep 30, 2025
c385372
refactor(harden): Remove scaffold dross
kriskowal Oct 10, 2025
256624f
refactor(harden): Duplicate ses make-hardener.js without modification
kriskowal Oct 10, 2025
33c8cf6
refactor(harden): Relive makeHardener of assert dependency
kriskowal Oct 10, 2025
c3fc16d
refactor(harden): Make traversePrototypes option of makeHardener
kriskowal Oct 10, 2025
58713a8
refactor(harden): Inline ses commons.js into make-hardener.js without…
kriskowal Oct 10, 2025
9ae2f53
refactor(harden): Do not export inline commons of make-harden.js
kriskowal Oct 10, 2025
ac43c78
refactor(harden): Inline Harden type in make-hardener.js
kriskowal Oct 10, 2025
535c437
refactor(harden): Remove unused commons in make-hardener
kriskowal Oct 10, 2025
23a4109
feat(harden): Add mechanism for detecting, providing, installing glob…
kriskowal Oct 10, 2025
741c9a2
feat(harden): Presumed hardened mode
kriskowal Oct 10, 2025
d047b72
feat(harden): Unsafe harden mode
kriskowal Oct 10, 2025
6ef5c11
feat(harden): Shallow harden mode
kriskowal Oct 10, 2025
3c4cba4
feat(harden): Export three modes
kriskowal Oct 10, 2025
9ece126
test(harden): Test all modes
kriskowal Oct 10, 2025
de30ffa
refactor(harden): Copy ses make-hardener.test.js without modification
kriskowal Oct 10, 2025
bd1cca1
refactor(harden): Adapt make-hardener test
kriskowal Oct 10, 2025
bc2ad3e
refactor(harden): Duplicate make-hardener test for shallow
kriskowal Oct 10, 2025
9432f38
refactor(harden): Adapt shallow make-hardener test
kriskowal Oct 10, 2025
5d375cc
chore: Update yarn.lock
kriskowal Oct 1, 2025
d52dcb9
doc(harden): README
kriskowal Oct 10, 2025
fefe633
fix(ses): (assert-shim): No error redaction without lockdown
kriskowal Oct 6, 2025
911b329
fix(module-source): Remove dependence on harden
kriskowal Oct 9, 2025
e5071d3
feat: Adopt @endo/harden
kriskowal Oct 9, 2025
79857eb
docs: NEWS of pre-lockdown support
kriskowal Oct 3, 2025
1ac2b86
test(compartment-mapper,init): Move init bundling test up the depende…
kriskowal Oct 9, 2025
7fcab30
test: Cover least-shimmed environment having embraced @endo/harden
kriskowal Oct 13, 2025
9e1a89b
test(patterns): Macro for individual pattern cases
kriskowal Oct 6, 2025
eaa2daa
test(import-bundle): Skip inescapable compartment test in pre-lockdow…
kriskowal Oct 13, 2025
50bf31d
test(pass-style): Relax tests to cover pre-lockdown mode
kriskowal Oct 13, 2025
99ad686
fix(lp32): Move @endo/init to devDependencies
kriskowal Oct 13, 2025
fdb5a7a
fix(init): Eliminate sensitivity to isExtensible which lies under uns…
kriskowal Nov 5, 2025
013e84c
refactor: Obviate harden.isFake checks with more specific and reliabl…
kriskowal Nov 6, 2025
ccda022
test: Noop-harden mode testing
kriskowal Nov 7, 2025
bfd1232
chore: Update yarn.lock
kriskowal Oct 13, 2025
f236c5b
refactor: Drive-by specificity of t.truthy t.falsy to t.true and t.false
kriskowal Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ava-noop-harden.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
nodeArguments: ['-C', 'noop-harden'],
files: ['test/**/*.test.*'],
timeout: '2m',
};
12 changes: 12 additions & 0 deletions packages/bundle-source/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
User-visible changes to `@endo/bundle-source`:

# Next release

- Relaxes dependence on a global, post-lockdown `harden` function by taking a
dependency on the new `@endo/harden` package.
Consequently, bundles will now entrain a `harden` implementation that is
superfluous if the bundled program is guaranteed to run in a post-lockdown
HardenedJS environment.
To compensate, use `bundle-source` with `-C hardened` or the analgous feature
for packaging conditions with your preferred bundler tool.
This will hollow out `@endo/harden` and defer exclusively to the global
`harden`.

# v4.1.0 (2025-06-02)

- The `'endoZipBase64'` moduleFormat now utilizes the `importHook` option to
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/cache.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-check
import harden from '@endo/harden';

Check failure on line 2 in packages/bundle-source/cache.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'
import { makePromiseKit } from '@endo/promise-kit';
import { makeReadPowers } from '@endo/compartment-mapper/node-powers.js';

Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@endo/base64": "workspace:^",
"@endo/compartment-mapper": "workspace:^",
"@endo/evasive-transform": "workspace:^",
"@endo/harden": "workspace:^",
"@endo/init": "workspace:^",
"@endo/promise-kit": "workspace:^",
"@endo/where": "workspace:^",
Expand Down
2 changes: 2 additions & 0 deletions packages/bundle-source/src/fs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// @ts-check
import harden from '@endo/harden';

Check failure on line 2 in packages/bundle-source/src/fs.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'

let mutex = Promise.resolve(undefined);

/**
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import fs from 'fs';
import os from 'os';

import harden from '@endo/harden';

Check failure on line 10 in packages/bundle-source/src/script.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'
import { makeFunctor } from '@endo/compartment-mapper/functor.js';
import { makeReadPowers } from '@endo/compartment-mapper/node-powers.js';

Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/src/zip-base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import fs from 'fs';
import os from 'os';

import harden from '@endo/harden';

Check failure on line 10 in packages/bundle-source/src/zip-base64.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'
import { mapNodeModules } from '@endo/compartment-mapper/node-modules.js';
import { makeAndHashArchiveFromMap } from '@endo/compartment-mapper/archive-lite.js';
import { encodeBase64 } from '@endo/base64';
Expand Down
12 changes: 12 additions & 0 deletions packages/captp/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
User-visible changes in `@endo/captp`:

# Next release

- Relaxes dependence on a global, post-lockdown `harden` function by taking a
dependency on the new `@endo/harden` package.
Consequently, bundles will now entrain a `harden` implementation that is
superfluous if the bundled program is guaranteed to run in a post-lockdown
HardenedJS environment.
To compensate, use `bundle-source` with `-C hardened` or the analgous feature
for packaging conditions with your preferred bundler tool.
This will hollow out `@endo/harden` and defer exclusively to the global
`harden`.

# v4.4.0 (2024-10-10)

- Add optional configuration `makeCapTPImportExportTables` for external management of import/export tables.
Expand Down
4 changes: 3 additions & 1 deletion packages/captp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"dependencies": {
"@endo/errors": "workspace:^",
"@endo/eventual-send": "workspace:^",
"@endo/harden": "workspace:^",
"@endo/marshal": "workspace:^",
"@endo/nat": "workspace:^",
"@endo/pass-style": "workspace:^",
Expand All @@ -71,7 +72,8 @@
},
"sesAvaConfigs": {
"lockdown": "../../ava-endo-lockdown.config.mjs",
"unsafe": "../../ava-endo-lockdown-unsafe.config.mjs"
"unsafe": "../../ava-endo-lockdown-unsafe.config.mjs",
"endo": "../../ava-endo-shims-only.config.mjs"
},
"eslintConfig": {
"extends": [
Expand Down
1 change: 1 addition & 0 deletions packages/captp/src/atomics.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import harden from '@endo/harden';

Check failure on line 1 in packages/captp/src/atomics.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'
import { X, Fail } from '@endo/errors';

// This is a pathological minimum, but exercised by the unit test.
Expand Down
2 changes: 2 additions & 0 deletions packages/captp/src/captp.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

// This logic was mostly adapted from an earlier version of Agoric's liveSlots.js with a
// good dose of https://github.com/capnproto/capnproto/blob/master/c++/src/capnp/rpc.capnp

import harden from '@endo/harden';

Check failure on line 9 in packages/captp/src/captp.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'
import { Remotable, Far, makeMarshal, QCLASS } from '@endo/marshal';
import { E, HandledPromise } from '@endo/eventual-send';
import { isPromise, makePromiseKit } from '@endo/promise-kit';
Expand Down
1 change: 1 addition & 0 deletions packages/captp/src/loopback.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import harden from '@endo/harden';

Check failure on line 1 in packages/captp/src/loopback.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'
import { Far } from '@endo/marshal';
import { E, makeCapTP } from './captp.js';
import { nearTrapImpl } from './trap.js';
Expand Down
2 changes: 2 additions & 0 deletions packages/captp/src/trap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Lifted mostly from `@endo/eventual-send/src/E.js`.

import harden from '@endo/harden';

Check failure on line 3 in packages/captp/src/trap.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'

const { freeze } = Object;

/**
Expand Down
6 changes: 4 additions & 2 deletions packages/captp/test/export-hook.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/* global globalThis */
import test from '@endo/ses-ava/test.js';

import harden from '@endo/harden';

Check failure on line 5 in packages/captp/test/export-hook.test.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'
import hardenIsNoop from '@endo/harden/is-noop.js';
import { Far } from '@endo/marshal';
import { E, makeLoopback } from '../src/loopback.js';

Expand Down Expand Up @@ -66,8 +68,8 @@

// Trigger the hook to throw.
harden(exports);
// @ts-ignore `isFake` purposely omitted from type
if (!harden.isFake) {
// We cannot rely on isExtensible when using lockdown with unsafe hardenTaming.
if (!hardenIsNoop(harden)) {
await t.throwsAsync(() => E(bs).echo(Promise.resolve('never exported')), {
message: /.*object is not extensible/,
});
Expand Down
1 change: 1 addition & 0 deletions packages/captp/test/loopback.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* global setTimeout */
import test from '@endo/ses-ava/test.js';

import harden from '@endo/harden';

Check failure on line 4 in packages/captp/test/loopback.test.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '@endo/harden'
import { Far } from '@endo/marshal';
import { E, makeLoopback } from '../src/loopback.js';

Expand Down
12 changes: 12 additions & 0 deletions packages/check-bundle/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@

# Next release

- Relaxes dependence on a global, post-lockdown `harden` function by taking a
dependency on the new `@endo/harden` package.
Consequently, bundles will now entrain a `harden` implementation that is
superfluous if the bundled program is guaranteed to run in a post-lockdown
HardenedJS environment.
To compensate, use `bundle-source` with `-C hardened` or the analgous feature
for packaging conditions with your preferred bundler tool.
This will hollow out `@endo/harden` and defer exclusively to the global
`harden`.

# 0.2.0 (2022-04-11)

- *BREAKING:* the `@endo/check-bundle` module exports Node.js convenience
Expand Down
1 change: 1 addition & 0 deletions packages/check-bundle/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-check
import harden from '@endo/harden';
import * as fs from 'fs';
import * as crypto from 'crypto';
import { checkBundle as powerlessCheckBundle } from './lite.js';
Expand Down
5 changes: 3 additions & 2 deletions packages/check-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"dependencies": {
"@endo/base64": "workspace:^",
"@endo/compartment-mapper": "workspace:^",
"@endo/errors": "workspace:^"
"@endo/errors": "workspace:^",
"@endo/harden": "workspace:^"
},
"devDependencies": {
"@endo/bundle-source": "workspace:^",
Expand Down Expand Up @@ -77,7 +78,7 @@
"sesAvaConfigs": {
"lockdown": "../../ava-endo-lockdown.config.mjs",
"unsafe": "../../ava-endo-lockdown-unsafe.config.mjs",
"shims": "../../ava-endo-shims-only.config.mjs"
"endo": "../../ava-endo-shims-only.config.mjs"
},
"typeCoverage": {
"atLeast": 86.95
Expand Down
18 changes: 9 additions & 9 deletions packages/check-bundle/test/check-bundle.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import test from 'ava';
import * as fs from 'fs';
import * as url from 'url';
import * as crypto from 'crypto';
import harden from '@endo/harden';
import bundleSource from '@endo/bundle-source';
import { ZipWriter } from '@endo/zip';
import { encodeBase64 } from '@endo/base64';
Expand Down Expand Up @@ -98,18 +99,17 @@ test('bundle and check corrupt endo zip base64 package', async t => {
);
});

test('bundle and hash unfrozen object', async t => {
const bundle = {};
await null;
// @ts-ignore `isFake` purposely omitted from type
if (harden.isFake) {
t.pass();
} else {
// This test is not possible if isFrozen is compromised by unsafe hardenTaming.
(Object.isFrozen({}) ? test.skip : test)(
'bundle and hash unfrozen object',
async t => {
const bundle = {};
await null;
await t.throwsAsync(checkBundle(bundle, computeSha512, 'fixture/main.js'), {
message: `checkBundle cannot vouch for the ongoing integrity of an unfrozen object, got {}`,
});
}
});
},
);

test('bundle and hash bogus package', async t => {
const bundle = Object.freeze({ moduleFormat: 'bogus' });
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@endo/eventual-send": "workspace:^",
"@endo/exo": "workspace:^",
"@endo/far": "workspace:^",
"@endo/harden": "workspace:^",
"@endo/import-bundle": "workspace:^",
"@endo/init": "workspace:^",
"@endo/lockdown": "workspace:^",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/commands/run.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* global globalThis, process */
import url from 'url';
import os from 'os';
import harden from '@endo/harden';
import { E, Far } from '@endo/far';
import { makeExo } from '@endo/exo';
import { M } from '@endo/patterns';
Expand Down
9 changes: 9 additions & 0 deletions packages/common/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ User-visible changes in `@endo/common`:
# Next release

- Deprecates this package's support for the checkFoo/assertCheck pattern (`Checker`, `identChecker`) in favor of the confirm/reject pattern supported by @endo/errors/rejector.js.
- Relaxes dependence on a global, post-lockdown `harden` function by taking a
dependency on the new `@endo/harden` package.
Consequently, bundles will now entrain a `harden` implementation that is
superfluous if the bundled program is guaranteed to run in a post-lockdown
HardenedJS environment.
To compensate, use `bundle-source` with `-C hardened` or the analgous feature
for packaging conditions with your preferred bundler tool.
This will hollow out `@endo/harden` and defer exclusively to the global
`harden`.

# v1.1.0 (2024-02-22)

Expand Down
1 change: 1 addition & 0 deletions packages/common/from-unique-entries.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import harden from '@endo/harden';
import { q, Fail } from '@endo/errors';

const { fromEntries } = Object;
Expand Down
2 changes: 2 additions & 0 deletions packages/common/ident-checker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import harden from '@endo/harden';

/**
* @deprecated Use `Rejector` in the confirm/reject pattern instead
* @callback Checker
Expand Down
2 changes: 2 additions & 0 deletions packages/common/list-difference.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import harden from '@endo/harden';

/**
* Return a list of all the elements present in the `leftList` and not
* in the `rightList`. Return in the order of their appearance in `leftList`.
Expand Down
1 change: 1 addition & 0 deletions packages/common/make-array-iterator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import harden from '@endo/harden';
import { makeIterator } from './make-iterator.js';

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/common/make-iterator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import harden from '@endo/harden';

/**
* Makes a one-shot iterable iterator from a provided `next` function.
*
Expand Down
2 changes: 2 additions & 0 deletions packages/common/object-map.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import harden from '@endo/harden';

const { entries, fromEntries } = Object;

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/common/object-meta-assign.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import harden from '@endo/harden';

const { getOwnPropertyDescriptors, defineProperties } = Object;

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/common/object-meta-map.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import harden from '@endo/harden';

const { getOwnPropertyDescriptors, create, fromEntries } = Object;
const { ownKeys } = Reflect;

Expand Down
4 changes: 3 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"dependencies": {
"@endo/errors": "workspace:^",
"@endo/eventual-send": "workspace:^",
"@endo/harden": "workspace:^",
"@endo/promise-kit": "workspace:^"
},
"devDependencies": {
Expand Down Expand Up @@ -74,6 +75,7 @@
},
"sesAvaConfigs": {
"lockdown": "../../ava-endo-lockdown.config.mjs",
"unsafe": "../../ava-endo-lockdown-unsafe.config.mjs"
"unsafe": "../../ava-endo-lockdown-unsafe.config.mjs",
"endo": "../../ava-endo-shims-only.config.mjs"
}
}
1 change: 1 addition & 0 deletions packages/common/test/from-unique-entries.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import test from '@endo/ses-ava/test.js';

import harden from '@endo/harden';
import { fromUniqueEntries } from '../from-unique-entries.js';

test('test fromUniqueEntries', async t => {
Expand Down
13 changes: 6 additions & 7 deletions packages/common/test/object-meta-map.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import test from '@endo/ses-ava/test.js';

import harden from '@endo/harden';
import hardenIsNoop from '@endo/harden/is-noop.js';
import { objectMetaMap } from '../object-meta-map.js';

const { getOwnPropertyDescriptors, getPrototypeOf } = Object;

// @ts-expect-error isFake is not advertised by the type of harden.
const hardenIsFake = !!harden.isFake;

test('test objectMetaMap', async t => {
const mapped = objectMetaMap(
{ a: 1, b: 2, c: 3 },
Expand All @@ -24,15 +23,15 @@ test('test objectMetaMap', async t => {
t.deepEqual(getOwnPropertyDescriptors(mapped), {
a: {
value: 2,
writable: hardenIsFake,
writable: hardenIsNoop(harden),
enumerable: false,
configurable: hardenIsFake,
configurable: hardenIsNoop(harden),
},
c: {
value: 6,
writable: hardenIsFake,
writable: hardenIsNoop(harden),
enumerable: false,
configurable: hardenIsFake,
configurable: hardenIsNoop(harden),
},
});
t.is(getPrototypeOf(mapped), null);
Expand Down
1 change: 1 addition & 0 deletions packages/compartment-mapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"ses": "workspace:^"
},
"devDependencies": {
"@endo/init": "workspace:^",
"ava": "catalog:dev",
"c8": "catalog:dev",
"eslint": "catalog:dev",
Expand Down
Loading
Loading