Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Javascript Extension (Just Not Overwriting) #1196

Closed
amark opened this issue May 27, 2022 · 3 comments
Closed

Allow Javascript Extension (Just Not Overwriting) #1196

amark opened this issue May 27, 2022 · 3 comments
Labels

Comments

@amark
Copy link

amark commented May 27, 2022

It obviously makes security sense to prevent

Object.keys

From being replaced.

But, SES also prevents me from polyfilling Object.keys if it doesn't exist. (Ah, SES doesn't work in older browsers, I'm assuming? That's not my fault tho as a library dev.)

Please allow for things to be extended. In your proxy you can just (pseudocode) check for:

if(target[key]){ return throw error }
target[key] = extension;

Security for read/getter accessors precede write/setters (as in, if the read/getters aren't verifiably enough on their own, then likely their is a security hole/gap waiting to be attacked.)

@Jack-Works
Copy link
Contributor

I believe this is duplicated to #925 and #318

@ljharb
Copy link

ljharb commented May 27, 2022

Polyfills must all be completed before SES locks things down.

@Tartuffo Tartuffo added the endo label Jun 9, 2022
@kriskowal
Copy link
Member

As @ljharb, polyfills must run before lockdown, but lockdown removes anything it doesn’t expressly permit. The latest version of SES now allows polyfills to run between the two phases of lockdown:

repairIntrinsics();
// your shim here
hardenIntrinsics();

This allows a polyfill to introduce new properties to shared intrinsics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants