endojs / endo

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

`isPassableError`, `assertPassableError`, and `toPassableError` judge non-frozen errors to be passable. #2173

Closed erights closed 3 months ago

erights commented 4 months ago

Describe the bug

isPassableError, assertPassableError, and toPassableError judge non-frozen errors to be passable.

Steps to reproduce

PR https://github.com/endojs/endo/pull/2156 , which would fix this bug, has the following test case

  const e = makeError('test error');
  // I include this test because I was recently surprised that the errors
  // make by `makeError` are not frozen, and therefore not passable.
  t.false(Object.isFrozen(e));
  t.false(isPassable(e));

  const e2 = toPassableError(e);

  t.is(e, e2);
  t.true (Object.isFrozen(e)); // currently fails
  t.true(isPassable(e)); // currently fails

Expected behavior

The test case shown above to pass

Platform environment

$ git describe --tags --always
@endo/bundle-source@3.2.1-17-g3739c409b