endo: Unable to import 'tape' v4 or v5 after lockdown

This program:

// install-ses.js consists of:
//  import { lockdown } from 'ses';
//  lockdown();
import './install-ses.js';
import { test } from 'tape';

when run against SES-0.7.7, with a node_modules that has tape-4.11.0, fails like this:

$ node -r esm fail-import-tape.js
/home/warner/stuff/agoric/agoric-sdk/node_modules/string.prototype.trim/node_modules/es-abstract/helpers/callBind.js:1
TypeError: Cannot assign to read only property 'apply' of function 'function callBind() {
	return bind.apply($call, arguments);
}'
    at Object.<anonymous> (/home/warner/stuff/agoric/agoric-sdk/node_modules/string.prototype.trim/node_modules/es-abstract/helpers/callBind.js:15:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)

I tried disabling various taming options in lockdown() and it didn’t help.

I’m guessing that tape is using some module (es-abstract?) which thinks it can modify the primordials. We could find a way to accomodate that, or find a way to make it stop.

I’m able to import tape before lockdown, and tests seem to work normally, which is what I’ll do for now. That makes it a ‘vetted shim’, though, and it’s neither vetted nor a shim. Discuss.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@warner @kriskowal I’m closing this as irrelevant, but reopen if I’m missing something or you disagree.

In summary, we discussed this at the Agoric SES meeting, and we do care about about tape versions running under SES.

cc @ljharb This is the issue that we encountered while using tape under ses. This motivated our prior solution, fixing overrides.