endo icon indicating copy to clipboard operation
endo copied to clipboard

Obsolete link to stale readthedocs somewhere

Open nathan-at-least opened this issue 2 years ago • 2 comments

I'm attempting to create a barebones usage of SES with docker.

While following https://ses-secure-ecmascript.readthedocs.io/en/stable/getting-started.html#installing-ses I created a Docker project with the following contents:

project contents

index.js

console.log('Hello World!');

const SES = require('ses');
console.log(SES);

const s = SES.makeSESRootRealm({consoleMode: 'allow', errorStackMode: 'allow'});
// NOTE: errorStackMode enables confinement breach, do not leave on in production
console.log(s.evaluate('1+2'));
console.log(s.evaluate('1+a', {a: 3}));

function double(a) {
  return a*2;
}
const doubler = s.evaluate(`(${double})`);

console.log(doubler(3));

package.json

{
  "dependencies": {
    "ses": "*"
  },
  "scripts": {
    "start": "node index.js"
  }
}

Dockerfile

FROM node:latest
RUN npm install -g npm

WORKDIR /usr/app
COPY ./ /usr/app
RUN npm install

CMD ["npm", "start"]

docker build output

The docker build seems to succeed:

$ docker build --no-cache -t ses-experiment .
Sending build context to Docker daemon  59.39kB
Step 1/6 : FROM node:latest
 ---> 7e9550136fca
Step 2/6 : RUN npm install -g npm
 ---> Running in 2309de2a412f

changed 24 packages, and audited 202 packages in 4s

11 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Removing intermediate container 2309de2a412f
 ---> 788fa7c2f8ed
Step 3/6 : WORKDIR /usr/app
 ---> Running in 4b5269b98c5e
Removing intermediate container 4b5269b98c5e
 ---> 013c697e6c1f
Step 4/6 : COPY ./ /usr/app
 ---> 71322b29fabd
Step 5/6 : RUN npm install
 ---> Running in c327e2be2730

added 1 package, and audited 2 packages in 2s

found 0 vulnerabilities
Removing intermediate container c327e2be2730
 ---> 8db41aad6e8e
Step 6/6 : CMD ["npm", "start"]
 ---> Running in c5c1068acc21
Removing intermediate container c5c1068acc21
 ---> 2c544698dcd8
Successfully built 2c544698dcd8
Successfully tagged ses-experiment:latest

docker run output

Running seems to successfully require('ses') but the resulting object doesn't have the makeSESRootRealm function:

$ docker run -t ses-experiment

> start
> node index.js

Hello World!
{}
/usr/app/index.js:6
const s = SES.makeSESRootRealm({consoleMode: 'allow', errorStackMode: 'allow'});
              ^

TypeError: SES.makeSESRootRealm is not a function
    at Object.<anonymous> (/usr/app/index.js:6:15)
    at Module._compile (node:internal/modules/cjs/loader:1120:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
    at Module.load (node:internal/modules/cjs/loader:998:32)
    at Module._load (node:internal/modules/cjs/loader:839:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

Node.js v18.6.0

nathan-at-least avatar Jul 26 '22 15:07 nathan-at-least

@nathan-at-least I need to scour our documentation for the link you followed to Read-The-Docs because that particular usage has been obsolete for at least two years. You will find current documentation in the SES README:

https://github.com/endojs/endo/tree/master/packages/ses#usage

SES.makeSESRootRealm is now spelled merely lockdown and it alters the realm in which it runs rather than creating a new one. Please let me know whether that gets you unblocked.

kriskowal avatar Jul 26 '22 18:07 kriskowal

Thanks!

I did a quick grep of this repo to find https://github.com/endojs/endo/tree/master/packages/ses/docs which links to the stale site, but I'm not sure if that's how I found it.

nathan-at-least avatar Jul 27 '22 02:07 nathan-at-least