Skip to content

Fix for non-configurable property access#274

Merged
patriksimek merged 3 commits intopatriksimek:masterfrom
XmiliaH:fix-272
Mar 29, 2020
Merged

Fix for non-configurable property access#274
patriksimek merged 3 commits intopatriksimek:masterfrom
XmiliaH:fix-272

Conversation

@XmiliaH
Copy link
Copy Markdown
Collaborator

@XmiliaH XmiliaH commented Mar 25, 2020

This should fix #272.
When a non-configurable property is requested, it is now copied into the proxy target and therfore shouldn't violate the proxy target handler rules any more.

@XmiliaH
Copy link
Copy Markdown
Collaborator Author

XmiliaH commented Mar 25, 2020

Lol, node crashed with core dump. Try to fix it later.

Need to look if this node crash can be abused somehow.
@XmiliaH XmiliaH requested a review from patriksimek March 25, 2020 12:20
local.Reflect.defineProperty(target, prop, desc);
}
} catch (e) {
// Should not happen.
Copy link
Copy Markdown

@jan-osch jan-osch Mar 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about that

(...)
} catch (e) {
   throwWhenInTest(e); // should not happen
}
(...)

The function throwWhenInTest could throw in your CI/local test environment and the errors would not go unnoticed.
Just a suggestion!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First I think this can't be reached, since getOwnPropertyDescriptor target is never a proxy. def.configurable is allways a own data property and defineProperty can't fail since target can't be a proxy and the property is either non existant or configurable.
Second I don't know if the exception is from host or sandbox, most likely from the sandbox, so I don't want to expose it. It is possible to stringify it in another try catch and pass the string, but I don't know if that is realy necessary.

@jan-osch
Copy link
Copy Markdown

Thanks for looking into #272.

const keys = local.Reflect.ownKeys(object);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
let desc = local.Reflect.getOwnPropertyDescriptor(object, key);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can actually throw since object could be a proxy.

@XmiliaH
Copy link
Copy Markdown
Collaborator Author

XmiliaH commented Mar 27, 2020

@jan-osch this is a bug, so I look into it. Question is how long it will take to get merged.

@patriksimek patriksimek merged commit d267a32 into patriksimek:master Mar 29, 2020
@patriksimek
Copy link
Copy Markdown
Owner

Thanks!

@patriksimek patriksimek mentioned this pull request Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants