Socket
Socket
Sign inDemoInstall

ses

Package Overview
Dependencies
Maintainers
3
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ses - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

.eslintignore

20

package.json
{
"name": "ses",
"version": "0.3.0",
"version": "0.4.0",
"description": "Secure ECMAScript",

@@ -11,5 +11,18 @@ "main": "src/commonjs-index.js",

"build-intermediate": "node scripts/build-intermediate.js",
"build": "git submodule update --init --recursive && node scripts/build-intermediate.js && rollup --format=iife --output.name=SES --output.exports=named --sourcemap --file=dist/ses-shim.js -- src/index.js"
"build": "git submodule update --init --recursive && node scripts/build-intermediate.js && rollup -c",
"pretty-fix": "prettier --write 'src/**/*.{js,jsx}' 'test/**/*.{js,jsx}'",
"pretty-check": "prettier --check 'src/**/*.{js,jsx}' 'test/**/*.{js,jsx}'",
"lint-fix": "eslint --fix 'src/**/*.{js,jsx}' 'test/**/*.{js,jsx}'",
"lint-check": "eslint 'src/**/*.{js,jsx}' 'test/**/*.{js,jsx}'"
},
"devDependencies": {
"@agoric/nat": "^2.0.0",
"eslint": "^5.11.1",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.12.0",
"prettier": "^1.16.4",
"rollup": "^1.1.0",

@@ -20,3 +33,4 @@ "rollup-plugin-node-resolve": "^4.0.0",

"dependencies": {
"esm": "^3.2.4"
"@agoric/make-hardener": "^0.0.4",
"esm": "^3.2.5"
},

@@ -23,0 +37,0 @@ "repository": {

178

src/bundle/anonIntrinsics.js

@@ -24,4 +24,2 @@ // Copyright (C) 2011 Google Inc.

/**

@@ -73,7 +71,8 @@ * <p>Qualifying platforms generally include all JavaScript platforms

export default function getAnonIntrinsics(global) {
"use strict";
'use strict';
const gopd = Object.getOwnPropertyDescriptor;
const getProto = Object.getPrototypeOf;
//////////////// Undeniables and Intrinsics //////////////
// ////////////// Undeniables and Intrinsics //////////////

@@ -107,7 +106,7 @@ /**

function* aStrictGenerator() {};
function* aStrictGenerator() {} // eslint-disable-line no-empty-function
const Generator = getProto(aStrictGenerator);
async function* aStrictAsyncGenerator() {};
async function* aStrictAsyncGenerator() {} // eslint-disable-line no-empty-function
const AsyncGenerator = getProto(aStrictAsyncGenerator);
async function aStrictAsyncFunction() {};
async function aStrictAsyncFunction() {} // eslint-disable-line no-empty-function
const AsyncFunctionPrototype = getProto(aStrictAsyncFunction);

@@ -120,3 +119,3 @@

['Object.prototype', Object.prototype, {}],
['Function.prototype', Function.prototype, function(){}],
['Function.prototype', Function.prototype, function foo() {}],
['Array.prototype', Array.prototype, []],

@@ -129,7 +128,7 @@ ['RegExp.prototype', RegExp.prototype, /x/],

['%AsyncGenerator%', AsyncGenerator, aStrictAsyncGenerator],
['%AsyncFunction%', AsyncFunctionPrototype, aStrictAsyncFunction]
['%AsyncFunction%', AsyncFunctionPrototype, aStrictAsyncFunction],
];
const undeniables = {};
undeniableTuples.forEach(function(tuple) {
undeniableTuples.forEach(tuple => {
const name = tuple[0];

@@ -139,12 +138,18 @@ const undeniable = tuple[1];

undeniables[name] = undeniable;
if (start === void 0) { return; }
if (start === undefined) {
return;
}
start = Object(start);
if (undeniable === start) { return; }
if (undeniable === getProto(start)) { return; }
throw new Error('Unexpected undeniable: ' + undeniable);
if (undeniable === start) {
return;
}
if (undeniable === getProto(start)) {
return;
}
throw new Error(`Unexpected undeniable: ${undeniable}`);
});
function registerIteratorProtos(registery, base, name) {
const iteratorSym = global.Symbol && global.Symbol.iterator ||
"@@iterator"; // used instead of a symbol on FF35
const iteratorSym =
(global.Symbol && global.Symbol.iterator) || '@@iterator'; // used instead of a symbol on FF35

@@ -154,3 +159,3 @@ if (base[iteratorSym]) {

const anIteratorPrototype = getProto(anIter);
registery[name] = anIteratorPrototype;
registery[name] = anIteratorPrototype; // eslint-disable-line no-param-reassign
const anIterProtoBase = getProto(anIteratorPrototype);

@@ -161,9 +166,8 @@ if (anIterProtoBase !== Object.prototype) {

throw new Error(
'%IteratorPrototype%.__proto__ was not Object.prototype');
'%IteratorPrototype%.__proto__ was not Object.prototype',
);
}
registery.IteratorPrototype = anIterProtoBase;
} else {
if (registery.IteratorPrototype !== anIterProtoBase) {
throw new Error('unexpected %' + name + '%.__proto__');
}
registery.IteratorPrototype = anIterProtoBase; // eslint-disable-line no-param-reassign
} else if (registery.IteratorPrototype !== anIterProtoBase) {
throw new Error(`unexpected %${name}%.__proto__`);
}

@@ -174,3 +178,2 @@ }

/**

@@ -197,2 +200,3 @@ * Get the intrinsics not otherwise reachable by named own property

// this is the only surviving ThrowTypeError intrinsic.
// eslint-disable-next-line prefer-rest-params
result.ThrowTypeError = gopd(arguments, 'callee').get;

@@ -204,66 +208,72 @@

// present.
(function() {
registerIteratorProtos(result, [], 'ArrayIteratorPrototype');
registerIteratorProtos(result, '', 'StringIteratorPrototype');
if (typeof Map === 'function') {
registerIteratorProtos(result, new Map(), 'MapIteratorPrototype');
}
if (typeof Set === 'function') {
registerIteratorProtos(result, new Set(), 'SetIteratorPrototype');
}
}());
registerIteratorProtos(result, [], 'ArrayIteratorPrototype');
registerIteratorProtos(result, '', 'StringIteratorPrototype');
if (typeof Map === 'function') {
registerIteratorProtos(result, new Map(), 'MapIteratorPrototype');
}
if (typeof Set === 'function') {
registerIteratorProtos(result, new Set(), 'SetIteratorPrototype');
}
// Get the ES6 %GeneratorFunction% intrinsic, if present.
(function() {
if (getProto(Generator) !== Function.prototype) {
throw new Error('Generator.__proto__ was not Function.prototype');
}
const GeneratorFunction = Generator.constructor;
if (getProto(GeneratorFunction) !== Function.prototype.constructor) {
throw new Error('GeneratorFunction.__proto__ was not Function.prototype.constructor');
}
result.GeneratorFunction = GeneratorFunction;
const genProtoBase = getProto(Generator.prototype);
if (genProtoBase !== result.IteratorPrototype) {
throw new Error('Unexpected Generator.prototype.__proto__');
}
}());
if (getProto(Generator) !== Function.prototype) {
throw new Error('Generator.__proto__ was not Function.prototype');
}
const GeneratorFunction = Generator.constructor;
if (getProto(GeneratorFunction) !== Function.prototype.constructor) {
throw new Error(
'GeneratorFunction.__proto__ was not Function.prototype.constructor',
);
}
result.GeneratorFunction = GeneratorFunction;
const genProtoBase = getProto(Generator.prototype);
if (genProtoBase !== result.IteratorPrototype) {
throw new Error('Unexpected Generator.prototype.__proto__');
}
// Get the ES6 %AsyncGeneratorFunction% intrinsic, if present.
(function() {
if (getProto(AsyncGenerator) !== Function.prototype) {
throw new Error('AsyncGenerator.__proto__ was not Function.prototype');
}
const AsyncGeneratorFunction = AsyncGenerator.constructor;
if (getProto(AsyncGeneratorFunction) !== Function.prototype.constructor) {
throw new Error('GeneratorFunction.__proto__ was not Function.prototype.constructor');
}
result.AsyncGeneratorFunction = AsyncGeneratorFunction;
// it appears that the only way to get an AsyncIteratorPrototype is
// through this getProto() process, so there's nothing to check it
// against
/*
const agenProtoBase = getProto(AsyncGenerator.prototype);
if (agenProtoBase !== result.AsyncIteratorPrototype) {
throw new Error('Unexpected AsyncGenerator.prototype.__proto__');
}*/
}());
if (getProto(AsyncGenerator) !== Function.prototype) {
throw new Error('AsyncGenerator.__proto__ was not Function.prototype');
}
const AsyncGeneratorFunction = AsyncGenerator.constructor;
if (getProto(AsyncGeneratorFunction) !== Function.prototype.constructor) {
throw new Error(
'AsyncGeneratorFunction.__proto__ was not Function.prototype.constructor',
);
}
result.AsyncGeneratorFunction = AsyncGeneratorFunction;
const AsyncGeneratorPrototype = AsyncGenerator.prototype;
result.AsyncIteratorPrototype = getProto(AsyncGeneratorPrototype);
// it appears that the only way to get an AsyncIteratorPrototype is
// through this getProto() process, so there's nothing to check it
// against
if (getProto(result.AsyncIteratorPrototype) !== Object.prototype) {
throw new Error(
'AsyncIteratorPrototype.__proto__ was not Object.prototype',
);
}
// Get the ES6 %AsyncFunction% intrinsic, if present.
(function() {
if (getProto(AsyncFunctionPrototype) !== Function.prototype) {
throw new Error('AsyncFunctionPrototype.__proto__ was not Function.prototype');
}
const AsyncFunction = AsyncFunctionPrototype.constructor;
if (getProto(AsyncFunction) !== Function.prototype.constructor) {
throw new Error('AsyncFunction.__proto__ was not Function.prototype.constructor');
}
result.AsyncFunction = AsyncFunction;
}());
if (getProto(AsyncFunctionPrototype) !== Function.prototype) {
throw new Error(
'AsyncFunctionPrototype.__proto__ was not Function.prototype',
);
}
const AsyncFunction = AsyncFunctionPrototype.constructor;
if (getProto(AsyncFunction) !== Function.prototype.constructor) {
throw new Error(
'AsyncFunction.__proto__ was not Function.prototype.constructor',
);
}
result.AsyncFunction = AsyncFunction;
// Get the ES6 %TypedArray% intrinsic, if present.
(function() {
if (!global.Float32Array) { return; }
(function getTypedArray() {
if (!global.Float32Array) {
return;
}
const TypedArray = getProto(global.Float32Array);
if (TypedArray === Function.prototype) { return; }
if (TypedArray === Function.prototype) {
return;
}
if (getProto(TypedArray) !== Function.prototype) {

@@ -276,9 +286,9 @@ // http://bespin.cz/~ondras/html/classv8_1_1ArrayBufferView.html

result.TypedArray = TypedArray;
}());
})();
for (let name in result) {
if (result[name] === void 0) {
throw new Error('Malformed intrinsic: ' + name);
Object.keys(result).forEach(name => {
if (result[name] === undefined) {
throw new Error(`Malformed intrinsic: ${name}`);
}
}
});

@@ -285,0 +295,0 @@ return result;

@@ -15,19 +15,21 @@ // Copyright (C) 2018 Agoric

import tameDate from './tame-date.js';
import tameMath from './tame-math.js';
import tameIntl from './tame-intl.js';
import tameError from './tame-error.js';
import tameRegExp from './tame-regexp.js';
import removeProperties from './removeProperties.js';
import getAnonIntrinsics from './anonIntrinsics.js';
import { deepFreeze } from './deepFreeze.js';
import hardenPrimordials from './hardenPrimordials.js';
import whitelist from './whitelist.js';
import { makeConsole } from './make-console.js';
import makeHardener from '@agoric/make-hardener';
import tameDate from './tame-date';
import tameMath from './tame-math';
import tameIntl from './tame-intl';
import tameError from './tame-error';
import tameRegExp from './tame-regexp';
import removeProperties from './removeProperties';
import getAnonIntrinsics from './anonIntrinsics';
import getAllPrimordials from './getAllPrimordials';
import whitelist from './whitelist';
import makeConsole from './make-console';
import makeMakeRequire from './make-require';
export function createSESWithRealmConstructor(creatorStrings, Realm) {
function makeSESRootRealm(options) {
// eslint-disable-next-line no-param-reassign
options = Object(options); // Todo: sanitize
let shims = [];
let wl = JSON.parse(JSON.stringify(whitelist));
const shims = [];
const wl = JSON.parse(JSON.stringify(whitelist));

@@ -37,7 +39,7 @@ // "allow" enables real Date.now(), anything else gets NaN

// implement right now)
if (options.dateNowMode !== "allow") {
if (options.dateNowMode !== 'allow') {
shims.push(`(${tameDate})();`);
}
if (options.mathRandomMode !== "allow") {
if (options.mathRandomMode !== 'allow') {
shims.push(`(${tameMath})();`);

@@ -49,3 +51,3 @@ }

// to add it to the whitelist too, as well as taming it properly.
if (options.intlMode !== "allow") {
if (options.intlMode !== 'allow') {
// this shim also disables Object.prototype.toLocaleString

@@ -63,5 +65,5 @@ shims.push(`(${tameIntl})();`);

*/
};
}
if (options.errorStackMode !== "allow") {
if (options.errorStackMode !== 'allow') {
shims.push(`(${tameError})();`);

@@ -79,3 +81,3 @@ } else {

if (options.regexpMode !== "allow") {
if (options.regexpMode !== 'allow') {
shims.push(`(${tameRegExp})();`);

@@ -91,11 +93,14 @@ }

let r = Realm.makeRootRealm({shims: shims});
const r = Realm.makeRootRealm({ shims });
// Build a harden() with an empty fringe. It will be populated later when
// we call harden(allIntrinsics).
const makeHardenerSrc = `(${makeHardener})`;
const harden = r.evaluate(makeHardenerSrc)();
const b = r.evaluate(creatorStrings);
b.createSESInThisRealm(r.global, creatorStrings, r);
//b.removeProperties(r.global);
r.global.def = b.def;
r.global.Nat = b.Nat;
// b.removeProperties(r.global);
if (options.consoleMode === "allow") {
if (options.consoleMode === 'allow') {
const s = `(${makeConsole})`;

@@ -106,9 +111,13 @@ r.global.console = r.evaluate(s)(console);

// Finally freeze all the primordials, and the global object. This must
// be the last thing we do.
const hardenPrimordialsSrc = `
const deepFreeze = (${deepFreeze});
const getAnonIntrinsics = (${getAnonIntrinsics});
(${hardenPrimordials})`;
r.evaluate(hardenPrimordialsSrc)(r.global);
// be the last thing we do that modifies the Realm's globals.
const anonIntrinsics = r.evaluate(`(${getAnonIntrinsics})`)(r.global);
const allIntrinsics = r.evaluate(`(${getAllPrimordials})`)(
r.global,
anonIntrinsics,
);
harden(allIntrinsics);
// build the makeRequire helper, glue it to the new Realm
r.makeRequire = harden(r.evaluate(`(${makeMakeRequire})`)(r, harden));
return r;

@@ -124,2 +133,3 @@ }

export function createSESInThisRealm(global, creatorStrings, parentRealm) {
// eslint-disable-next-line no-param-reassign,no-undef
global.SES = createSESWithRealmConstructor(creatorStrings, Realm);

@@ -135,3 +145,3 @@ // todo: wrap exceptions, effectively undoing the wrapping that

['TypeError', TypeError],
['URIError', URIError]
['URIError', URIError],
]);

@@ -159,3 +169,5 @@

}
let eName, eMessage, eStack;
let eName;
let eMessage;
let eStack;
try {

@@ -196,6 +208,8 @@ // The child environment might seek to use 'err' to reach the

global.SES.confine = (code, endowments) => callAndWrapError(
() => parentRealm.evaluate(code, endowments));
global.SES.confineExpr = (code, endowments) => callAndWrapError(
() => parentRealm.evaluate(`(${code})`, endowments));
// eslint-disable-next-line no-param-reassign
global.SES.confine = (code, endowments) =>
callAndWrapError(() => parentRealm.evaluate(code, endowments));
// eslint-disable-next-line no-param-reassign
global.SES.confineExpr = (code, endowments) =>
callAndWrapError(() => parentRealm.evaluate(`(${code})`, endowments));
}

@@ -15,8 +15,7 @@ // Copyright (C) 2018 Agoric

import { createSESWithRealmConstructor, createSESInThisRealm } from './createSES.js';
import { def } from './def.js';
import { Nat } from './nat.js';
import {
createSESWithRealmConstructor,
createSESInThisRealm,
} from './createSES';
export { createSESWithRealmConstructor, createSESInThisRealm,
def, Nat
};
export { createSESWithRealmConstructor, createSESInThisRealm };

@@ -1,3 +0,2 @@

export function makeConsole(parentConsole) {
export default function makeConsole(parentConsole) {
/* 'parentConsole' is the parent Realm's original 'console' object. We must

@@ -19,3 +18,3 @@ wrap it, exposing a 'console' with a 'console.log' (and perhaps others)

['TypeError', TypeError],
['URIError', URIError]
['URIError', URIError],
]);

@@ -31,3 +30,5 @@

}
let eName, eMessage, eStack;
let eName;
let eMessage;
let eStack;
try {

@@ -65,6 +66,14 @@ // The child environment might seek to use 'err' to reach the

const newConsole = {};
const passThrough = ['log', 'info', 'warn', 'error',
'group', 'groupEnd',
'trace',
'time', 'timeLog', 'timeEnd'];
const passThrough = [
'log',
'info',
'warn',
'error',
'group',
'groupEnd',
'trace',
'time',
'timeLog',
'timeEnd',
];
// TODO: those are the properties that MDN documents. Node.js has a bunch

@@ -86,3 +95,3 @@ // of additional ones that I didn't include, which might be appropriate.

// can we make that "newConsole.trace" ?
newConsole[name] = function(...args) {
newConsole[name] = function newerConsole(...args) {
callAndWrapError(orig, ...args);

@@ -95,2 +104,1 @@ };

}

@@ -22,3 +22,3 @@ /* global getAnonIntrinsics */

import */
//import { getAnonIntrinsics } from './anonIntrinsics.js';
// import { getAnonIntrinsics } from './anonIntrinsics.js';

@@ -28,6 +28,9 @@ export default function removeProperties(global, whitelist) {

const uncurryThis = fn => (thisArg, ...args) => Reflect.apply(fn, thisArg, args);
const gopd = Object.getOwnPropertyDescriptor;
const gopn = Object.getOwnPropertyNames;
const keys = Object.keys;
const uncurryThis = fn => (thisArg, ...args) =>
Reflect.apply(fn, thisArg, args);
const {
getOwnPropertyDescriptor: gopd,
getOwnPropertyNames: gopn,
keys,
} = Object;
const cleaning = new WeakMap();

@@ -39,3 +42,3 @@ const getProto = Object.getPrototypeOf;

function addToWhiteTable(global, rootPermit) {
function addToWhiteTable(rootValue, rootPermit) {
/**

@@ -52,6 +55,10 @@ * The whiteTable should map from each path-accessible primordial

function register(value, permit) {
if (value !== Object(value)) { return; }
if (value !== Object(value)) {
return;
}
if (typeof permit !== 'object') {
if (whitelistSymbols.indexOf(permit) < 0) {
throw new Error('syntax error in whitelist; unexpected value: ' + permit);
throw new Error(
`syntax error in whitelist; unexpected value: ${permit}`,
);
}

@@ -64,3 +71,3 @@ return;

whiteTable.set(value, permit);
keys(permit).forEach(function(name) {
keys(permit).forEach(name => {
// Use gopd to avoid invoking an accessor property.

@@ -75,6 +82,5 @@ // Accessor properties for which permit !== 'maybeAccessor'

}
register(global, rootPermit);
register(rootValue, rootPermit);
}
/**

@@ -91,7 +97,12 @@ * Should the property named {@code name} be whitelisted on the

if (permit) {
if (hop(permit, name)) { return permit[name]; }
if (hop(permit, name)) {
return permit[name];
}
}
// eslint-disable-next-line no-constant-condition
while (true) {
base = getProto(base);
if (base === null) { return false; }
base = getProto(base); // eslint-disable-line no-param-reassign
if (base === null) {
return false;
}
permit = whiteTable.get(base);

@@ -102,5 +113,4 @@ if (permit && hop(permit, name)) {

return result;
} else {
return false;
}
return false;
}

@@ -118,6 +128,6 @@ }

function clean(value, prefix, num) {
if (value !== Object(value)) {
if (value !== Object(value)) {
return;
}
if (cleaning.get(value)) {
if (cleaning.get(value)) {
return;

@@ -128,3 +138,3 @@ }

if (proto !== null && !whiteTable.has(proto)) {
//reportItemProblem(rootReports, ses.severities.NOT_ISOLATED,
// reportItemProblem(rootReports, ses.severities.NOT_ISOLATED,
// 'unexpected intrinsic', prefix + '.__proto__');

@@ -135,3 +145,3 @@ throw new Error(`unexpected intrinsic ${prefix}.__proto__`);

cleaning.set(value, true);
gopn(value).forEach(function(name) {
gopn(value).forEach(name => {
const path = prefix + (prefix ? '.' : '') + name;

@@ -144,18 +154,16 @@ const p = getPermit(value, name);

const subValue = desc.value;
clean(subValue, path, num+1);
clean(subValue, path, num + 1);
} else if (p !== 'maybeAccessor') {
// We are not saying that it is safe for the prop to be
// unexpectedly an accessor; rather, it will be deleted
// and thus made safe.
// reportProperty(ses.severities.SAFE_SPEC_VIOLATION,
// 'Not a data property', path);
delete value[name]; // eslint-disable-line no-param-reassign
} else {
if (p !== 'maybeAccessor') {
// We are not saying that it is safe for the prop to be
// unexpectedly an accessor; rather, it will be deleted
// and thus made safe.
//reportProperty(ses.severities.SAFE_SPEC_VIOLATION,
// 'Not a data property', path);
delete value[name];
} else {
clean(desc.get, path + '<getter>', num+1);
clean(desc.set, path + '<setter>', num+1);
}
clean(desc.get, `${path}<getter>`, num + 1);
clean(desc.set, `${path}<setter>`, num + 1);
}
} else {
delete value[name];
delete value[name]; // eslint-disable-line no-param-reassign
}

@@ -162,0 +170,0 @@ });

@@ -1,2 +0,1 @@

export default function tameDate() {

@@ -24,6 +23,8 @@ const unsafeDate = Date;

Object.defineProperties(newDateConstructor,
Object.getOwnPropertyDescriptors(unsafeDate));
Object.defineProperties(
newDateConstructor,
Object.getOwnPropertyDescriptors(unsafeDate),
);
// that will copy the .prototype too, so this next line is unnecessary
//newDateConstructor.prototype = unsafeDate.prototype;
// newDateConstructor.prototype = unsafeDate.prototype;
unsafeDate.prototype.constructor = newDateConstructor;

@@ -33,3 +34,3 @@ // disable Date.now

Date = newDateConstructor;
Date = newDateConstructor; // eslint-disable-line no-global-assign
}

@@ -1,4 +0,3 @@

export default function tameError() {
if (!(Object.isExtensible(Error))) {
if (!Object.isExtensible(Error)) {
throw Error('huh Error is not extensible');

@@ -5,0 +4,0 @@ }

@@ -11,6 +11,13 @@ /* global Intl */

if (typeof Intl !== 'undefined') {
Intl.DateTimeFormat = () => { throw Error("disabled"); };
Intl.NumberFormat = () => { throw Error("disabled"); };
Intl.getCanonicalLocales = () => { throw Error("disabled"); };
Intl.DateTimeFormat = () => {
throw Error('disabled');
};
Intl.NumberFormat = () => {
throw Error('disabled');
};
Intl.getCanonicalLocales = () => {
throw Error('disabled');
};
}
// eslint-disable-next-line no-extend-native
Object.prototype.toLocaleString = () => {

@@ -17,0 +24,0 @@ throw new Error('toLocaleString suppressed');

@@ -1,5 +0,6 @@

export default function tameMath() {
//Math.random = () => 4; // https://www.xkcd.com/221
Math.random = () => { throw Error("disabled"); };
// Math.random = () => 4; // https://www.xkcd.com/221
Math.random = () => {
throw Error('disabled');
};
}

@@ -1,2 +0,1 @@

export default function tameRegExp() {

@@ -12,2 +11,3 @@ delete RegExp.prototype.compile;

// eslint-disable-next-line no-global-assign
RegExp = function RegExp(...args) {

@@ -22,3 +22,2 @@ return Reflect.construct(unsafeRegExp, args, new.target);

}
}

@@ -107,5 +107,5 @@ // Copyright (C) 2011 Google Inc.

const t = true;
const j = true; // included in the Jessie runtime
const j = true; // included in the Jessie runtime
let TypedArrayWhitelist; // defined and used below
let TypedArrayWhitelist; // defined and used below

@@ -122,3 +122,4 @@ export default {

ThrowTypeError: {},
IteratorPrototype: { // 25.1
IteratorPrototype: {
// 25.1
// Technically, for SES-on-ES5, we should not need to

@@ -132,3 +133,3 @@ // whitelist 'next'. However, browsers are accidentally

next: '*',
constructor: false
constructor: false,
},

@@ -139,2 +140,4 @@ ArrayIteratorPrototype: {},

SetIteratorPrototype: {},
// AsyncIteratorPrototype does not inherit from IteratorPrototype
AsyncIteratorPrototype: {},

@@ -155,5 +158,7 @@ // The %GeneratorFunction% intrinsic is the constructor of

// inherit from this object.
GeneratorFunction: { // 25.2
length: '*', // Not sure why this is needed
prototype: { // 25.4
GeneratorFunction: {
// 25.2
length: '*', // Not sure why this is needed
prototype: {
// 25.4
prototype: {

@@ -163,9 +168,11 @@ next: '*',

throw: '*',
constructor: '*' // Not sure why this is needed
}
}
constructor: '*', // Not sure why this is needed
},
},
},
AsyncGeneratorFunction: { // 25.3
AsyncGeneratorFunction: {
// 25.3
length: '*',
prototype: { // 25.5
prototype: {
// 25.5
prototype: {

@@ -175,7 +182,8 @@ next: '*',

throw: '*',
constructor: '*' // Not sure why this is needed
}
}
constructor: '*', // Not sure why this is needed
},
},
},
AsyncFunction: { // 25.7
AsyncFunction: {
// 25.7
length: '*',

@@ -185,5 +193,6 @@ prototype: '*',

TypedArray: TypedArrayWhitelist = { // 22.2
length: '*', // does not inherit from Function.prototype on Chrome
name: '*', // ditto
TypedArray: (TypedArrayWhitelist = {
// 22.2
length: '*', // does not inherit from Function.prototype on Chrome
name: '*', // ditto
from: t,

@@ -220,5 +229,5 @@ of: t,

values: '*',
BYTES_PER_ELEMENT: '*'
}
}
BYTES_PER_ELEMENT: '*',
},
}),
},

@@ -231,3 +240,2 @@

// 18 The Global Object

@@ -242,3 +250,3 @@

// eval: t, // Whitelisting under separate control
// by TAME_GLOBAL_EVAL in startSES.js
// by TAME_GLOBAL_EVAL in startSES.js
isFinite: t,

@@ -253,18 +261,18 @@ isNaN: t,

// 19 Fundamental Objects
Object: { // 19.1
assign: t, // ES-Harmony
Object: {
// 19.1
assign: t, // ES-Harmony
create: t,
defineProperties: t, // ES-Harmony
defineProperties: t, // ES-Harmony
defineProperty: t,
entries: t, // ES-Harmony
entries: t, // ES-Harmony
freeze: j,
getOwnPropertyDescriptor: t,
getOwnPropertyDescriptors: t, // proposed ES-Harmony
getOwnPropertyDescriptors: t, // proposed ES-Harmony
getOwnPropertyNames: t,
getOwnPropertySymbols: t, // ES-Harmony
getOwnPropertySymbols: t, // ES-Harmony
getPrototypeOf: t,
is: j, // ES-Harmony
is: j, // ES-Harmony
isExtensible: t,

@@ -276,7 +284,6 @@ isFrozen: t,

seal: j,
setPrototypeOf: t, // ES-Harmony
values: t, // ES-Harmony
setPrototypeOf: t, // ES-Harmony
values: t, // ES-Harmony
prototype: {
// B.2.2

@@ -301,7 +308,8 @@ // __proto__: t, whitelisted manually in startSES.js

[Symbol.toStringTag]: '*',
[Symbol.unscopables]: '*'
}
[Symbol.unscopables]: '*',
},
},
Function: { // 19.2
Function: {
// 19.2
length: t,

@@ -316,17 +324,19 @@ prototype: {

length: '*',
name: '*', // ES-Harmony
name: '*', // ES-Harmony
prototype: '*',
arity: '*', // non-std, deprecated in favor of length
arity: '*', // non-std, deprecated in favor of length
// Generally allowed
[Symbol.species]: 'maybeAccessor' // ES-Harmony?
}
[Symbol.species]: 'maybeAccessor', // ES-Harmony?
},
},
Boolean: { // 19.3
prototype: t
Boolean: {
// 19.3
prototype: t,
},
Symbol: { // 19.4 all ES-Harmony
asyncIterator: t, // proposed? ES-Harmony
Symbol: {
// 19.4 all ES-Harmony
asyncIterator: t, // proposed? ES-Harmony
for: t,

@@ -345,10 +355,11 @@ hasInstance: t,

unscopables: t,
prototype: t
prototype: t,
},
Error: { // 19.5
Error: {
// 19.5
prototype: {
name: '*',
message: '*'
}
message: '*',
},
},

@@ -365,37 +376,37 @@ // In ES6 the *Error "subclasses" of Error inherit from Error,

EvalError: {
prototype: t
prototype: t,
},
RangeError: {
prototype: t
prototype: t,
},
ReferenceError: {
prototype: t
prototype: t,
},
SyntaxError: {
prototype: t
prototype: t,
},
TypeError: {
prototype: t
prototype: t,
},
URIError: {
prototype: t
prototype: t,
},
// 20 Numbers and Dates
Number: { // 20.1
EPSILON: t, // ES-Harmony
isFinite: j, // ES-Harmony
isInteger: t, // ES-Harmony
isNaN: j, // ES-Harmony
isSafeInteger: j, // ES-Harmony
MAX_SAFE_INTEGER: j, // ES-Harmony
Number: {
// 20.1
EPSILON: t, // ES-Harmony
isFinite: j, // ES-Harmony
isInteger: t, // ES-Harmony
isNaN: j, // ES-Harmony
isSafeInteger: j, // ES-Harmony
MAX_SAFE_INTEGER: j, // ES-Harmony
MAX_VALUE: t,
MIN_SAFE_INTEGER: j, // ES-Harmony
MIN_SAFE_INTEGER: j, // ES-Harmony
MIN_VALUE: t,
NaN: t,
NEGATIVE_INFINITY: t,
parseFloat: t, // ES-Harmony
parseInt: t, // ES-Harmony
parseFloat: t, // ES-Harmony
parseInt: t, // ES-Harmony
POSITIVE_INFINITY: t,

@@ -405,7 +416,8 @@ prototype: {

toFixed: t,
toPrecision: t
}
toPrecision: t,
},
},
Math: { // 20.2
Math: {
// 20.2
E: j,

@@ -422,40 +434,41 @@ LN10: j,

acos: t,
acosh: t, // ES-Harmony
acosh: t, // ES-Harmony
asin: t,
asinh: t, // ES-Harmony
asinh: t, // ES-Harmony
atan: t,
atanh: t, // ES-Harmony
atanh: t, // ES-Harmony
atan2: t,
cbrt: t, // ES-Harmony
cbrt: t, // ES-Harmony
ceil: j,
clz32: t, // ES-Harmony
clz32: t, // ES-Harmony
cos: t,
cosh: t, // ES-Harmony
cosh: t, // ES-Harmony
exp: t,
expm1: t, // ES-Harmony
expm1: t, // ES-Harmony
floor: j,
fround: t, // ES-Harmony
hypot: t, // ES-Harmony
imul: t, // ES-Harmony
fround: t, // ES-Harmony
hypot: t, // ES-Harmony
imul: t, // ES-Harmony
log: j,
log1p: t, // ES-Harmony
log10: j, // ES-Harmony
log2: j, // ES-Harmony
log1p: t, // ES-Harmony
log10: j, // ES-Harmony
log2: j, // ES-Harmony
max: j,
min: j,
pow: j,
random: t, // questionable
random: t, // questionable
round: j,
sign: t, // ES-Harmony
sign: t, // ES-Harmony
sin: t,
sinh: t, // ES-Harmony
sinh: t, // ES-Harmony
sqrt: j,
tan: t,
tanh: t, // ES-Harmony
trunc: j // ES-Harmony
tanh: t, // ES-Harmony
trunc: j, // ES-Harmony
},
// no-arg Date constructor is questionable
Date: { // 20.3
now: t, // questionable
Date: {
// 20.3
now: t, // questionable
parse: t,

@@ -510,20 +523,20 @@ UTC: t,

setYear: t,
toGMTString: t
}
toGMTString: t,
},
},
// 21 Text Processing
String: { // 21.2
String: {
// 21.2
fromCharCode: j,
fromCodePoint: t, // ES-Harmony
raw: j, // ES-Harmony
fromCodePoint: t, // ES-Harmony
raw: j, // ES-Harmony
prototype: {
charAt: t,
charCodeAt: t,
codePointAt: t, // ES-Harmony
codePointAt: t, // ES-Harmony
concat: t,
endsWith: j, // ES-Harmony
includes: t, // ES-Harmony
endsWith: j, // ES-Harmony
includes: t, // ES-Harmony
indexOf: j,

@@ -533,6 +546,6 @@ lastIndexOf: j,

match: t,
normalize: t, // ES-Harmony
padEnd: t, // ES-Harmony
padStart: t, // ES-Harmony
repeat: t, // ES-Harmony
normalize: t, // ES-Harmony
padEnd: t, // ES-Harmony
padStart: t, // ES-Harmony
repeat: t, // ES-Harmony
replace: t,

@@ -542,3 +555,3 @@ search: t,

split: t,
startsWith: j, // ES-Harmony
startsWith: j, // ES-Harmony
substring: t,

@@ -567,11 +580,12 @@ toLocaleLowerCase: t,

trimLeft: t, // non-standard
trimRight: t, // non-standard
trimLeft: t, // non-standard
trimRight: t, // non-standard
// 21.1.4 instances
length: '*'
}
length: '*',
},
},
RegExp: { // 21.2
RegExp: {
// 21.2
prototype: {

@@ -582,43 +596,43 @@ exec: t,

ignoreCase: 'maybeAccessor',
[Symbol.match]: '*', // ES-Harmony
[Symbol.match]: '*', // ES-Harmony
multiline: 'maybeAccessor',
[Symbol.replace]: '*', // ES-Harmony
[Symbol.search]: '*', // ES-Harmony
[Symbol.replace]: '*', // ES-Harmony
[Symbol.search]: '*', // ES-Harmony
source: 'maybeAccessor',
[Symbol.split]: '*', // ES-Harmony
[Symbol.split]: '*', // ES-Harmony
sticky: 'maybeAccessor',
test: t,
unicode: 'maybeAccessor', // ES-Harmony
dotAll: 'maybeAccessor', // proposed ES-Harmony
unicode: 'maybeAccessor', // ES-Harmony
dotAll: 'maybeAccessor', // proposed ES-Harmony
// B.2.5
compile: false, // UNSAFE. Purposely suppressed
compile: false, // UNSAFE. Purposely suppressed
// 21.2.6 instances
lastIndex: '*',
options: '*' // non-std
}
options: '*', // non-std
},
},
// 22 Indexed Collections
Array: { // 22.1
Array: {
// 22.1
from: j,
isArray: t,
of: j, // ES-Harmony?
of: j, // ES-Harmony?
prototype: {
concat: t,
copyWithin: t, // ES-Harmony
entries: t, // ES-Harmony
copyWithin: t, // ES-Harmony
entries: t, // ES-Harmony
every: t,
fill: t, // ES-Harmony
fill: t, // ES-Harmony
filter: j,
find: t, // ES-Harmony
findIndex: t, // ES-Harmony
find: t, // ES-Harmony
findIndex: t, // ES-Harmony
forEach: j,
includes: t, // ES-Harmony
includes: t, // ES-Harmony
indexOf: j,
join: t,
keys: t, // ES-Harmony
keys: t, // ES-Harmony
lastIndexOf: j,

@@ -637,7 +651,7 @@ map: j,

unshift: j,
values: t, // ES-Harmony
values: t, // ES-Harmony
// 22.1.4 instances
length: '*'
}
length: '*',
},
},

@@ -658,6 +672,6 @@

// 23 Keyed Collections all ES-Harmony
Map: { // 23.1
Map: {
// 23.1
prototype: {

@@ -673,7 +687,8 @@ clear: j,

size: 'maybeAccessor',
values: j
}
values: j,
},
},
Set: { // 23.2
Set: {
// 23.2
prototype: {

@@ -688,7 +703,8 @@ add: j,

size: 'maybeAccessor',
values: j
}
values: j,
},
},
WeakMap: { // 23.3
WeakMap: {
// 23.3
prototype: {

@@ -699,25 +715,26 @@ // Note: coordinate this list with maintenance of repairES5.js

has: j,
set: j
}
set: j,
},
},
WeakSet: { // 23.4
WeakSet: {
// 23.4
prototype: {
add: j,
delete: j,
has: j
}
has: j,
},
},
// 24 Structured Data
ArrayBuffer: { // 24.1 all ES-Harmony
ArrayBuffer: {
// 24.1 all ES-Harmony
isView: t,
length: t, // does not inherit from Function.prototype on Chrome
name: t, // ditto
length: t, // does not inherit from Function.prototype on Chrome
name: t, // ditto
prototype: {
byteLength: 'maybeAccessor',
slice: t
}
slice: t,
},
},

@@ -727,6 +744,7 @@

DataView: { // 24.3 all ES-Harmony
length: t, // does not inherit from Function.prototype on Chrome
name: t, // ditto
BYTES_PER_ELEMENT: '*', // non-standard. really?
DataView: {
// 24.3 all ES-Harmony
length: t, // does not inherit from Function.prototype on Chrome
name: t, // ditto
BYTES_PER_ELEMENT: '*', // non-standard. really?
prototype: {

@@ -751,4 +769,4 @@ buffer: 'maybeAccessor',

setUint16: t,
setUint32: t
}
setUint32: t,
},
},

@@ -758,11 +776,12 @@

JSON: { // 24.5
JSON: {
// 24.5
parse: j,
stringify: j
stringify: j,
},
// 25 Control Abstraction Objects
Promise: { // 25.4
Promise: {
// 25.4
all: j,

@@ -775,3 +794,3 @@ race: j,

then: j,
finally: t, // proposed ES-Harmony
finally: t, // proposed ES-Harmony

@@ -790,4 +809,4 @@ // nanoq.js

delete: t,
end: t
}
end: t,
},
},

@@ -816,9 +835,9 @@

memoize: t,
defer: t
defer: t,
},
// 26 Reflection
Reflect: { // 26.1
Reflect: {
// 26.1
apply: t,

@@ -836,10 +855,10 @@ construct: t,

set: t,
setPrototypeOf: t
setPrototypeOf: t,
},
Proxy: { // 26.2
revocable: t
Proxy: {
// 26.2
revocable: t,
},
// Appendix B

@@ -855,6 +874,7 @@

StringMap: { // A specialized approximation of ES-Harmony's Map.
prototype: {} // Technically, the methods should be on the prototype,
// but doing so while preserving encapsulation will be
// needlessly expensive for current usage.
StringMap: {
// A specialized approximation of ES-Harmony's Map.
prototype: {}, // Technically, the methods should be on the prototype,
// but doing so while preserving encapsulation will be
// needlessly expensive for current usage.
},

@@ -866,5 +886,5 @@

prototype: {
global: "maybeAccessor",
evaluate: t
}
global: 'maybeAccessor',
evaluate: t,
},
},

@@ -874,9 +894,8 @@

confine: t,
confineExpr: t
confineExpr: t,
},
Nat: j,
def: j
}
def: j,
},
};

@@ -1,3 +0,3 @@

const esmRequire = require("esm")(module);
module.exports = esmRequire("./index.js");
const esmRequire = require('esm')(module);
module.exports = esmRequire('./index.js');

@@ -15,7 +15,7 @@ // Copyright (C) 2018 Agoric

import SES from './SES.js';
import { def, Nat } from './bundle/index.js';
const makeSESRootRealm = SES.makeSESRootRealm;
import SES from './SES';
const { makeSESRootRealm } = SES;
export default SES;
export { def, Nat, SES, makeSESRootRealm };
export { SES, makeSESRootRealm };

@@ -28,5 +28,4 @@ // this should be usable like:

// f = compileExpr(source); then f(imports) can only affect 'imports'
//exports.compileExpr = function(exprSrc, opt_mitigateOpts) { };
// exports.compileExpr = function(exprSrc, opt_mitigateOpts) { };
/*

@@ -33,0 +32,0 @@ exports.makeRootSESRealm = function() {

@@ -15,7 +15,7 @@ // Copyright (C) 2018 Agoric

import { createSESWithRealmConstructor } from './bundle/index.js';
import { createSESWithRealmConstructor } from './bundle/index';
import { creatorStrings } from './stringifiedBundle';
import Realm from '../proposal-realms/shim/src/realm.js';
import Realm from '../proposal-realms/shim/src/realm';
const SES = createSESWithRealmConstructor(creatorStrings, Realm);
export default SES;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc