Socket
Socket
Sign inDemoInstall

ses

Package Overview
Dependencies
Maintainers
5
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.15.9 to 0.15.10

9

CHANGELOG.md

@@ -6,2 +6,11 @@ # Change Log

### [0.15.10](https://github.com/endojs/endo/compare/ses@0.15.9...ses@0.15.10) (2022-03-02)
### Features
* add evalTaming option ([#961](https://github.com/endojs/endo/issues/961)) ([735ff94](https://github.com/endojs/endo/commit/735ff94bf3513613e64aaca03116f289d07aa366))
### [0.15.9](https://github.com/endojs/endo/compare/ses@0.15.8...ses@0.15.9) (2022-02-20)

@@ -8,0 +17,0 @@

1

index.d.ts

@@ -26,2 +26,3 @@ /* eslint-disable no-restricted-globals, vars-on-top, no-var */

mathTaming?: 'safe' | 'unsafe'; // deprecated
evalTaming?: 'safeEval' | 'unsafeEval' | 'noEval';
stackFiltering?: 'concise' | 'verbose';

@@ -28,0 +29,0 @@ overrideTaming?: 'moderate' | 'min' | 'severe';

12

package.json
{
"name": "ses",
"version": "0.15.9",
"version": "0.15.10",
"description": "Hardened JavaScript for Fearless Cooperation",

@@ -62,6 +62,6 @@ "keywords": [

"devDependencies": {
"@endo/compartment-mapper": "^0.6.7",
"@endo/eslint-config": "^0.4.4",
"@endo/static-module-record": "^0.6.14",
"@endo/test262-runner": "^0.1.20",
"@endo/compartment-mapper": "^0.7.0",
"@endo/eslint-config": "^0.4.5",
"@endo/static-module-record": "^0.6.15",
"@endo/test262-runner": "^0.1.21",
"ava": "^3.12.1",

@@ -182,3 +182,3 @@ "babel-eslint": "^10.0.3",

},
"gitHead": "bbefeb4e9869df15a031be1cd6fc57a50b2906e0"
"gitHead": "08973d4fc6358a58d733251b051b2812bb4c651a"
}

@@ -275,1 +275,7 @@ /* global globalThis */

export const FERAL_FUNCTION = Function;
export const noEvalEvaluate = () => {
throw new TypeError(
'Cannot eval with evalTaming set to "noEval" (SES_NO_EVAL)',
);
};

@@ -26,2 +26,3 @@ // @ts-check

setGlobalObjectMutableProperties,
setGlobalObjectEvaluators,
} from './global-object.js';

@@ -296,6 +297,12 @@ import { isValidIdentifierName } from './scope-constants.js';

makeCompartmentConstructor: targetMakeCompartmentConstructor,
safeEvaluate,
markVirtualizedNativeFunction,
});
// TODO: maybe add evalTaming to the Compartment constructor 3rd options?
setGlobalObjectEvaluators(
globalObject,
safeEvaluate,
markVirtualizedNativeFunction,
);
assign(globalObject, endowments);

@@ -302,0 +309,0 @@

@@ -37,3 +37,2 @@ import { defineProperty, objectHasOwnProperty, entries } from './commons.js';

* @param {Function} param1.makeCompartmentConstructor
* @param {(string, Object?) => any} param1.safeEvaluate
* @param {(Object) => void} param1.markVirtualizedNativeFunction

@@ -47,3 +46,2 @@ */

makeCompartmentConstructor,
safeEvaluate,
markVirtualizedNativeFunction,

@@ -76,4 +74,2 @@ },

globalThis: globalObject,
eval: makeEvalFunction(safeEvaluate),
Function: makeFunctionConstructor(safeEvaluate),
};

@@ -101,1 +97,36 @@

};
/**
* setGlobalObjectEvaluators()
* Set the eval and the Function evaluator on the global object with given evalTaming policy.
*
* @param {Object} globalObject
* @param {Function} evaluator
* @param {(Object) => void} markVirtualizedNativeFunction
*/
export const setGlobalObjectEvaluators = (
globalObject,
evaluator,
markVirtualizedNativeFunction,
) => {
{
const f = makeEvalFunction(evaluator);
markVirtualizedNativeFunction(f);
defineProperty(globalObject, 'eval', {
value: f,
writable: true,
enumerable: false,
configurable: true,
});
}
{
const f = makeFunctionConstructor(evaluator);
markVirtualizedNativeFunction(f);
defineProperty(globalObject, 'Function', {
value: f,
writable: true,
enumerable: false,
configurable: true,
});
}
};

@@ -27,2 +27,3 @@ // Copyright (C) 2018 Agoric

stringSplit,
noEvalEvaluate,
} from './commons.js';

@@ -42,2 +43,3 @@ import { enJoin } from './error/stringify-utils.js';

setGlobalObjectMutableProperties,
setGlobalObjectEvaluators,
} from './global-object.js';

@@ -169,2 +171,3 @@ import { makeSafeEvaluator } from './make-safe-evaluator.js';

domainTaming = getenv('LOCKDOWN_DOMAIN_TAMING', 'safe'),
evalTaming = getenv('LOCKDOWN_EVAL_TAMING', 'safeEval'),
overrideDebug = arrayFilter(

@@ -195,2 +198,9 @@ stringSplit(getenv('LOCKDOWN_OVERRIDE_DEBUG', ''), ','),

assert(
evalTaming === 'unsafeEval' ||
evalTaming === 'safeEval' ||
evalTaming === 'noEval',
d`lockdown(): non supported option evalTaming: ${q(evalTaming)}`,
);
// Assert that only supported options were passed.

@@ -331,4 +341,2 @@ // Use Reflect.ownKeys to reject symbol-named properties as well.

const { safeEvaluate } = makeSafeEvaluator({ globalObject: globalThis });
setGlobalObjectMutableProperties(globalThis, {

@@ -338,6 +346,24 @@ intrinsics,

makeCompartmentConstructor,
safeEvaluate,
markVirtualizedNativeFunction,
});
if (evalTaming === 'noEval') {
setGlobalObjectEvaluators(
globalThis,
noEvalEvaluate,
markVirtualizedNativeFunction,
);
} else if (evalTaming === 'safeEval') {
const { safeEvaluate } = makeSafeEvaluator({ globalObject: globalThis });
setGlobalObjectEvaluators(
globalThis,
safeEvaluate,
markVirtualizedNativeFunction,
);
} else if (evalTaming === 'unsafeEval') {
// Leave eval function and Function constructor of the initial compartment in-tact.
// Other compartments will not have access to these evaluators unless a guest program
// escapes containment.
}
/**

@@ -344,0 +370,0 @@ * 3. HARDEN to share the intrinsics.

@@ -1,5 +0,7 @@

/*
/**
* makeEvalFunction()
* A safe version of the native eval function which relies on
* the safety of safeEvaluate for confinement.
*
* @param {Function} safeEvaluate
*/

@@ -6,0 +8,0 @@ export const makeEvalFunction = safeEvaluate => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

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

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

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

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