Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ses

Package Overview
Dependencies
Maintainers
5
Versions
105
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.13.3 to 0.13.4

8

CHANGELOG.md

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

### [0.13.4](https://github.com/endojs/endo/compare/ses@0.13.3...ses@0.13.4) (2021-06-20)
**Note:** Version bump only for package ses
### [0.13.3](https://github.com/endojs/endo/compare/ses@0.13.2...ses@0.13.3) (2021-06-16)

@@ -8,0 +16,0 @@

185

index.d.ts

@@ -1,52 +0,151 @@

/* eslint-disable */
/**
* Transitively freeze an object.
*/
import type { Hardener } from './src/make-hardener';
import type { CompartmentConstructor } from './src/compartment-shim';
import type { Lockdown } from './src/lockdown-shim';
import type { StaticModuleRecord } from './module-shim';
// For scripts.
declare var harden: Hardener;
declare var lockdown: Lockdown;
declare var Compartment : ReturnType<CompartmentConstructor>;
declare var StaticModuleRecord : StaticModuleRecord;
// It's academically tempting to define a hardened type, but TypeScript doesn't
// strike a good balance in distinguishing "readonly" in the sense that you
// promise not to change vs "readonly" in the sense that you depend on a thing
// not changing.
// type Hardened<T> =
// T extends number | bigint | string | null | undefined | Function ? T :
// { readonly [P in keyof T]: Hardened<T[P]> };
declare type StaticModuleType = RedirectStaticModuleInterface | FinalStaticModuleType;
declare interface RedirectStaticModuleInterface {
readonly record: FinalStaticModuleType,
// So Harden just passes the type through without modification.
// This will occasionally conflict with the type of Object.freeze.
// In those cases, we recommend casting the result of Object.freeze to the
// original thawn type, as if the signature of freeze were identical to this
// version of harden.
export type Harden = <T>(value: T) => T; // not Hardened<T>;
export interface LockdownOptions {
regExpTaming?: 'safe' | 'unsafe';
localeTaming?: 'safe' | 'unsafe';
consoleTaming?: 'safe' | 'unsafe';
errorTaming?: 'safe' | 'unsafe';
dateTaming?: 'safe' | 'unsafe'; // deprecated
mathTaming?: 'safe' | 'unsafe'; // deprecated
stackFiltering?: 'concise' | 'verbose';
overrideTaming?: 'moderate' | 'min' | 'severe';
overrideDebug?: Array<string>;
__allowUnsafeMonkeyPatching__?: 'safe' | 'unsafe';
}
export type Lockdown = (options?: LockdownOptions) => void;
export type __LiveExportsMap__ = Record<string, [string, boolean]>
export type __FixedExportsMap__ = Record<string, [string]>
export interface PrecompiledStaticModuleInterface {
imports: Array<string>;
exports: Array<string>;
reexports: Array<string>;
__syncModuleProgram__: string;
__liveExportsMap__: __LiveExportsMap__;
__fixedExportsMap__: __FixedExportsMap__;
}
export interface ThirdPartyStaticModuleInterface {
imports: Array<string>;
exports: Array<string>;
execute(proxiedExports: Object, compartment: Compartment, resolvedImports: Record<string, string>): void;
}
export type FinalStaticModuleType = PrecompiledStaticModuleInterface | ThirdPartyStaticModuleInterface
export interface RedirectStaticModuleInterface {
record: FinalStaticModuleType,
specifier: string
};
declare type FinalStaticModuleType = StaticModuleRecord | ThirdPartyModuleInterface;
declare interface ThirdPartyStaticModuleInterface {
readonly imports: Array<string>,
readonly execute: (exports: Object) => void,
};
}
declare type Transform = (source: string) => string;
declare type ImportHook = (moduleSpecifier: string) => Promise<Object>;
declare type ModuleMapHook = (moduleSpecifier: string) => string | Object | void;
export type StaticModuleType = RedirectStaticModuleInterface | FinalStaticModuleType
export type ModuleExportsNamespace = Record<string, any>
export type Transform = (source: string) => string;
export type ResolveHook = (importSpecifier: string, referrerSpecifier: string) => string;
export type ModuleMap = Record<string, string | ModuleExportsNamespace>;
export type ModuleMapHook = (moduleSpecifier: string) => string | ModuleExportsNamespace | void;
export type ImportHook = (moduleSpecifier: string) => Promise<StaticModuleType>;
export interface CompartmentOptions {
name?: string;
transforms?: Array<Transform>;
globalLexicals?: Record<string, any>;
moduleMapHook?: ModuleMapHook,
importHook?: ImportHook,
resolveHook?: ResolveHook,
__shimTransforms__?: Array<Transform>;
}
export interface EvaluateOptions {
transforms?: Array<Transform>;
sloppyGlobalsMode?: boolean;
__moduleShimLexicals__?: Record<string, any>;
__evadeHtmlCommentTest__?: boolean;
__rejectSomeDirectEvalExpressions__?: boolean;
}
// The DetailsToken is an empty object literal.
export type DetailsToken = Record<any, never>
export type Details = string | DetailsToken
export interface AssertMakeErrorOptions {
}
type AssertTypeofBigint = (specimen: any, typeName: 'bigint', details?: Details) => asserts specimen is bigint;
type AssertTypeofBoolean = (specimen: any, typeName: 'boolean', details?: Details) => asserts specimen is boolean;
type AssertTypeofFunction = (specimen: any, typeName: 'function', details?: Details) => asserts specimen is Function;
type AssertTypeofNumber = (specimen: any, typeName: 'number', details?: Details) => asserts specimen is number;
type AssertTypeofObject = (specimen: any, typeName: 'object', details?: Details) => asserts specimen is Record<any, any> | null;
type AssertTypeofString = (specimen: any, typeName: 'string', details?: Details) => asserts specimen is string;
type AssertTypeofSymbol = (specimen: any, typeName: 'symbol', details?: Details) => asserts specimen is symbol;
type AssertTypeofUndefined = (specimen: any, typeName: 'undefined', details?: Details) => asserts specimen is undefined;
export type AssertTypeof = AssertTypeofBigint &
AssertTypeofBoolean &
AssertTypeofFunction &
AssertTypeofNumber &
AssertTypeofObject &
AssertTypeofString &
AssertTypeofSymbol &
AssertTypeofUndefined;
export type Raise = (reason: Error) => void;
export type MakeAssert = (raise?: Raise, unredacted?: boolean) => Assert;
interface ToStringable {
toString(): string
}
export interface Assert {
(value: any, details?: Details, errorConstructor?:ErrorConstructor): void;
typeof: AssertTypeof,
error(details?: Details, errorConstructor?:ErrorConstructor): Error;
fail(details?: Details, errorConstructor?:ErrorConstructor): never;
equal(left: any, right: any, details?: Details, errorConstructor?:ErrorConstructor): void;
string(specimen: any, details?: Details): void;
note(error: Error, details: Details): void;
details(template: TemplateStringsArray | string[], ...args: any): DetailsToken,
quote(payload: any, spaces?: string|number): ToStringable,
makeAssert: MakeAssert,
}
declare global {
// For modules.
var harden: Hardener;
var lockdown : Lockdown;
var Compartment : ReturnType<CompartmentConstructor>;
var StaticModuleRecord : StaticModuleRecord;
var harden: Harden;
type StaticModuleType = RedirectStaticModuleInterface | FinalStaticModuleType;
interface RedirectStaticModuleInterface {
readonly record: FinalStaticModuleType,
specifier: string
};
type FinalStaticModuleType = StaticModuleRecord | ThirdPartyModuleInterface;
interface ThirdPartyStaticModuleInterface {
readonly imports: Array<string>,
readonly execute: (exports: Object) => void,
};
var lockdown: Lockdown;
type Transform = (source: string) => string;
type ImportHook = (moduleSpecifier: string) => Promise<Object>;
type ModuleMapHook = (moduleSpecifier: string) => string | Object | void;
var assert: Assert;
/**
* Each Compartment constructor is a global. A host that wants to execute
* code in a context bound to a new global creates a new compartment.
*/
export class Compartment {
constructor(globals?: Object, moduleMap?: ModuleMap, options?:CompartmentOptions);
get globalThis(): Record<string, any>;
get name(): string;
evaluate(code: string): any;
import(specifier: string): Promise<{namespace: ModuleExportsNamespace}>;
load(specifier: string): Promise<void>;
importNow(specifier: string): ModuleExportsNamespace;
module(specifier: string): ModuleExportsNamespace;
}
}
User-visible changes in SES:
# Next version
# 0.2.2 (2021-06-19)
- Adds more TypeScript definitions, importable with `/// <reference
types="ses"/>`, covering `harden`, `lockdown`, `assert`, and `Compartment`,
and many types importable with `import('ses')` notation.
- Adds descriptive detail to module system link error messages and fixes the

@@ -6,0 +9,0 @@ reported exports for one.

{
"name": "ses",
"version": "0.13.3",
"version": "0.13.4",
"description": "Secure ECMAScript",

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

"devDependencies": {
"@endo/compartment-mapper": "^0.4.0",
"@endo/eslint-config": "^0.3.10",
"@endo/static-module-record": "^0.5.3",
"@endo/test262-runner": "^0.1.4",
"@endo/compartment-mapper": "^0.4.1",
"@endo/eslint-config": "^0.3.11",
"@endo/static-module-record": "^0.5.4",
"@endo/test262-runner": "^0.1.5",
"ava": "^3.12.1",

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

},
"gitHead": "f91c84cde6cfe82c085ebe316da939d04ca74aa4"
"gitHead": "9e01f1b96869b8296eed9c6a408e74132a556449"
}
// @ts-check
/* eslint no-underscore-dangle: ["off"] */
/* eslint-disable no-underscore-dangle */
/// <reference types="ses">

@@ -218,21 +219,7 @@ import {

/**
* @callback CompartmentConstructor
* Each Compartment constructor is a global. A host that wants to execute
* code in a context bound to a new global creates a new compartment.
*
* @param {Object} endowments
* @param {Object} _moduleMap
* @param {Object} [options]
* @param {string} [options.name]
* @param {Array<Transform>} [options.transforms]
* @param {Array<Transform>} [options.__shimTransforms__]
* @param {Object} [options.globalLexicals]
*/
/**
* @callback MakeCompartmentConstructor
* @param {MakeCompartmentConstructor} targetMakeCompartmentConstructor
* @param {Object} intrinsics
* @param {Record<string, any>} intrinsics
* @param {(object: Object) => void} nativeBrander
* @returns {CompartmentConstructor}
* @returns {Compartment['constructor']}
*/

@@ -246,3 +233,2 @@

) => {
/** @type {CompartmentConstructor} */
function Compartment(endowments = {}, moduleMap = {}, options = {}) {

@@ -249,0 +235,0 @@ if (new.target === undefined) {

@@ -62,4 +62,4 @@ // @ts-check

// Type all the overloads of the assertTypeof function.
// There may eventually be a better way to do this, but
// thems the breaks with Typescript 4.0.
// There may eventually be a better way to do this, but they break with
// Typescript 4.0.
/**

@@ -66,0 +66,0 @@ * @callback AssertTypeofBigint

@@ -36,16 +36,3 @@ // Copyright (C) 2018 Agoric

/**
* @typedef {{
* dateTaming?: 'safe' | 'unsafe',
* errorTaming?: 'safe' | 'unsafe',
* mathTaming?: 'safe' | 'unsafe',
* regExpTaming?: 'safe' | 'unsafe',
* localeTaming?: 'safe' | 'unsafe',
* consoleTaming?: 'safe' | 'unsafe',
* overrideTaming?: 'min' | 'moderate' | 'severe',
* overrideDebug?: Array<string>,
* stackFiltering?: 'concise' | 'verbose',
* __allowUnsafeMonkeyPatching__?: 'safe' | 'unsafe',
* }} LockdownOptions
*/
/** @typedef {import('../index.js').LockdownOptions} LockdownOptions */

@@ -139,5 +126,5 @@ const { details: d, quote: q } = assert;

const {
dateTaming = 'safe',
dateTaming = 'safe', // deprecated
errorTaming = 'safe',
mathTaming = 'safe',
mathTaming = 'safe', // deprecated
regExpTaming = 'safe',

@@ -174,5 +161,5 @@ localeTaming = 'safe',

firstOptions = {
dateTaming,
dateTaming, // deprecated
errorTaming,
mathTaming,
mathTaming, // deprecated
regExpTaming,

@@ -330,2 +317,3 @@ localeTaming,

* @param {() => Object} getAnonymousIntrinsics
* @returns {import('../index.js').Lockdown}
*/

@@ -351,3 +339,1 @@ export const makeLockdown = (

};
/** @typedef {ReturnType<typeof makeLockdown>} Lockdown */

@@ -28,3 +28,3 @@ // Adapted from SES/Caja - Copyright (C) 2011 Google Inc.

/**
* @typedef {<T>(root: T) => T} Hardener
* @typedef {import('../index.js').Harden} Harden
*/

@@ -35,3 +35,3 @@

*
* @returns {Hardener}
* @returns {Harden}
*/

@@ -38,0 +38,0 @@ export const makeHardener = () => {

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 not supported yet

Sorry, the diff of this file is not supported yet

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