fix: Unsafe errorTaming and consoleTaming needs other adjustments
MODIFY
packages/ses/lockdown-options.md
packages/ses/lockdown-options.md
@@ -135,8 +135,12 @@ lockdown(); // consoleTaming defaults to 'safe'
lockdown({ consoleTaming: 'safe' }); // Wrap start console to show deep stacks
// vs
lockdown({ consoleTaming: 'unsafe' }); // Leave original start console in place
+// or
+lockdown({
+ consoleTaming: 'unsafe', // Leave original start console in place
+ overrideTaming: 'min', // Until https://github.com/endojs/endo/issues/636
+});
```
-
The `consoleTaming: 'unsafe'` setting leaves the original console in place.
The `assert` package and error objects will continue to work, but the `console`
logging output will not show any of this extra information.
@@ -149,6 +153,12 @@ methods violate ocap security. Until we know otherwise, we should assume these
are unsafe. Such a raw `console` object should only be handled by very
trustworthy code.
+Until the bug
+[Node console gets confused if .constructor is an accessor (#636)](https://github.com/endojs/endo/issues/636)
+is fixed, if you use the `consoleTaming: 'unsafe'` setting and might be running
+with the Node `console`, we advise you to also set `overrideTaming: 'min'` so
+that no builtin `constructor` properties are turned into accessors.
+
Examples from
[test-deep-send.js](https://github.com/Agoric/agoric-sdk/blob/master/packages/eventual-send/test/test-deep-send.js)
of the eventual-send shim:
@@ -262,11 +272,22 @@ acts like
assert(false, X`literal part ${q(secretData)} with ${q(publicData)}.`);
```
+The `lockdown({ errorTaming: 'unsafe' })` call has this effect by replacing
+the global `assert` object with one whose `assert.details` does not redact.
+So be sure to sample `assert` and `assert.details` only after such a call to
+lockdown:
+
+```js
+lockdown({ errorTaming: 'unsafe' });
+
+// Grab `details` only after lockdown
+const { details: X, quote: q } = assert;
+```
+
Like with the stack, the SES shim `console` object always
shows the unredacted detailed error message independent of the setting of
`errorTaming`.
-
## `stackFiltering` Options
**Background**: The error stacks shown by many JavaScript engines are

MODIFY
packages/ses/test/error/test-tame-console-unfilteredError.js
packages/ses/test/error/test-tame-console-unfilteredError.js
@@ -2,12 +2,12 @@ import test from 'ava';
import '../../ses.js';
import { getPrototypeOf } from '../../src/commons.js';
-const { details: d } = assert;
-
const originalConsole = console;
lockdown({ stackFiltering: 'verbose' });
+const { details: d } = assert;
+
test('console', t => {
t.plan(3);

MODIFY
packages/ses/test/error/test-tame-console-unsafe-unfilteredError.js
packages/ses/test/error/test-tame-console-unsafe-unfilteredError.js
@@ -2,12 +2,12 @@ import test from 'ava';
import '../../ses.js';
import { getPrototypeOf } from '../../src/commons.js';
-const { details: d } = assert;
-
const originalConsole = console;
lockdown({ consoleTaming: 'unsafe', stackFiltering: 'verbose' });
+const { details: d } = assert;
+
test('console', t => {
t.plan(3);

MODIFY
packages/ses/test/error/test-tame-console-unsafe-unsafeError-unfilteredError.js
packages/ses/test/error/test-tame-console-unsafe-unsafeError-unfilteredError.js
@@ -2,16 +2,18 @@ import test from 'ava';
import '../../ses.js';
import { getPrototypeOf } from '../../src/commons.js';
-const { details: d } = assert;
-
const originalConsole = console;
lockdown({
consoleTaming: 'unsafe',
errorTaming: 'unsafe',
stackFiltering: 'verbose',
+ overrideTaming: 'min',
});
+// Grab `details` only after lockdown
+const { details: d } = assert;
+
test('console', t => {
t.plan(3);

MODIFY
packages/ses/test/error/test-tame-console-unsafe-unsafeError.js
packages/ses/test/error/test-tame-console-unsafe-unsafeError.js
@@ -2,11 +2,16 @@ import test from 'ava';
import '../../ses.js';
import { getPrototypeOf } from '../../src/commons.js';
-const { details: d } = assert;
-
const originalConsole = console;
-lockdown({ consoleTaming: 'unsafe', errorTaming: 'unsafe' });
+lockdown({
+ consoleTaming: 'unsafe',
+ errorTaming: 'unsafe',
+ overrideTaming: 'min',
+});
+
+// Grab `details` only after lockdown
+const { details: d } = assert;
test('console', t => {
t.plan(3);

MODIFY
packages/ses/test/error/test-tame-console-unsafe.js
packages/ses/test/error/test-tame-console-unsafe.js
@@ -2,12 +2,12 @@ import test from 'ava';
import '../../ses.js';
import { getPrototypeOf } from '../../src/commons.js';
-const { details: d } = assert;
-
const originalConsole = console;
lockdown({ consoleTaming: 'unsafe' });
+const { details: d } = assert;
+
test('console', t => {
t.plan(3);

MODIFY
packages/ses/test/error/test-tame-console-unsafeError.js
packages/ses/test/error/test-tame-console-unsafeError.js
@@ -2,12 +2,13 @@ import test from 'ava';
import '../../ses.js';
import { getPrototypeOf } from '../../src/commons.js';
-const { details: d } = assert;
-
const originalConsole = console;
lockdown({ errorTaming: 'unsafe' });
+// Grab `details` only after lockdown
+const { details: d } = assert;
+
test('console', t => {
t.plan(3);

MODIFY
packages/ses/test/error/test-tame-console.js
packages/ses/test/error/test-tame-console.js
@@ -2,12 +2,12 @@ import test from 'ava';
import '../../ses.js';
import { getPrototypeOf } from '../../src/commons.js';
-const { details: d } = assert;
-
const originalConsole = console;
lockdown();
+const { details: d } = assert;
+
test('console', t => {
t.plan(3);

fix: Unsafe errorTaming and consoleTaming needs other adjustments (#637)