Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/ses/src/permits.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ const accessor = {
set: fn,
};

const nullDesc = {
value: null,
}

// eslint-disable-next-line func-names
const strict = function () {
'use strict';
Expand Down Expand Up @@ -2194,6 +2198,8 @@ export const permitted = {
// Properties of the TextEncoder Constructor
'[[Proto]]': '%FunctionPrototype%',
prototype: '%TextEncoderPrototype%',
arguments: nullDesc,
caller: nullDesc,
},

'%TextEncoderPrototype%': {
Expand All @@ -2211,6 +2217,8 @@ export const permitted = {
// Properties of the TextDecoder Constructor
'[[Proto]]': '%FunctionPrototype%',
prototype: '%TextDecoderPrototype%',
arguments: nullDesc,
caller: nullDesc,
},

'%TextDecoderPrototype%': {
Expand Down
21 changes: 21 additions & 0 deletions packages/ses/test/permits-chrome-126.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// @ts-nocheck
import test from 'ava';
import 'ses';

test('TextEncoder arguments and caller properties as seen in chrome 126 are permitted', t => {
// Reproduce the broken behavior in Chrome 126
const descr = {
value: null,
writable: false,
enumerable: false,
configurable: false,
};
Object.defineProperty(globalThis.TextEncoder, 'caller', descr);
Object.defineProperty(globalThis.TextEncoder, 'arguments', descr);
Object.defineProperty(globalThis.TextDecoder, 'caller', descr);
Object.defineProperty(globalThis.TextDecoder, 'arguments', descr);

t.notThrows(() => {
lockdown();
});
});
Loading