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

Partial fix for #864 - report property attributes from sandbox object #885

Closed
wants to merge 1 commit into from

Conversation

smikes
Copy link
Contributor

@smikes smikes commented Feb 18, 2015

Here's a failing test for issue #864

@cjihrig
Copy link
Contributor

cjihrig commented Feb 19, 2015

Please do not merge this in while the test is still failing.

GlobalPropertyQueryCallback() was returning `None`
as attributes for all properties, without regard
to actual properties settings.

This patch looks up attributes for sandbox-defined
properties and returns them.  Partial fix for nodejsgh-864

Add test for nodejsgh-864, non-default settings of
object properties (e.g., `enumerable: false`) are not
visible when object is used as a sandbox
@smikes smikes changed the title add failing test Partial fix for #864 - report property attributes from sandbox object Feb 19, 2015
@smikes
Copy link
Contributor Author

smikes commented Feb 19, 2015

Test is no longer failing; a change to node_contextify.cc is a partial fix for #864 and fixes the behavior tested in test-vm-preserves-property.js.

@smikes
Copy link
Contributor Author

smikes commented Feb 19, 2015

Although this PR was originally inspired by #864, it is complete in itself and reports sandbox property attributes correctly.

The full fix for #864 may involve changes to v8 APIs upstream (see @bnoordhuis comments in #884).

In the meantime, I believe this PR is now ready for review.

v8::PropertyAttribute attr = None;
if (in_sandbox) {
attr = sandbox->GetPropertyAttributes(property);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we also add if (in_proxy_global) { attr = proxy_global->GetPropertyAttributes(property); } as the fallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried that. It caused infinite recursion on proxy_global. I think @bnoordhuis has a patch into v8 to add a new api to support this.

That's why this change is "partial fix"

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Also given that per #855 I want to at least attempt to rip out proxy global entirely that might end up being unnecessary.

Probably want to leave a TODO(smikes) in the source code though for later.

@domenic
Copy link
Contributor

domenic commented Feb 23, 2015

LGTM if you add a TODO. (I am not an official LGTM-er though.)

@brendanashworth
Copy link
Contributor

Is there an update on this? see

@mscdex mscdex added the vm Issues and PRs related to the vm subsystem. label Mar 22, 2015
@smikes
Copy link
Contributor Author

smikes commented Mar 27, 2015

I will try to finish this this weekend.

@bnoordhuis
Copy link
Member

Apropos that V8 patch, it landed in v8/v8@726eb05 and should probably be back-ported. That makes it a semver-minor thing because it's a new public API. It's also going to break building against a shared libv8 that doesn't carry the patch. :-/

@domenic
Copy link
Contributor

domenic commented May 22, 2015

@smikes any chance of landing this on next, with the updates?

@@ -387,11 +387,15 @@ class ContextifyContext {
Local<Object> proxy_global = PersistentToLocal(isolate,
ctx->proxy_global_);

bool in_sandbox = sandbox->GetRealNamedProperty(property).IsEmpty();
bool in_sandbox = !(sandbox->GetRealNamedProperty(property).IsEmpty());
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not HasRealNamedProperty ?

@domenic
Copy link
Contributor

domenic commented May 22, 2015

Actually I think I can take this over.

domenic added a commit to domenic/io.js that referenced this pull request May 22, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of nodejs#885.

Fixes nodejs#885; fixes nodejs#864.
domenic added a commit to domenic/io.js that referenced this pull request Jun 1, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of nodejs#885.

Fixes nodejs#885; fixes nodejs#864.
domenic added a commit to domenic/io.js that referenced this pull request Jun 1, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of nodejs#885.

Fixes nodejs#885; fixes nodejs#864.
domenic added a commit to domenic/io.js that referenced this pull request Jun 1, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of nodejs#885.

Fixes nodejs#885; fixes nodejs#864.
chrisdickinson pushed a commit that referenced this pull request Jun 3, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of #885.

Fixes: #864
Fixes: #885
PR-URL: #1773
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@bnoordhuis
Copy link
Member

Closing, fixed by a45fbfc.

@bnoordhuis bnoordhuis closed this Jun 5, 2015
domenic added a commit that referenced this pull request Jun 17, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of #885.

Fixes: #864
Fixes: #885
PR-URL: #1773
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
domenic added a commit that referenced this pull request Jul 22, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of #885.

Fixes: #864
Fixes: #885
PR-URL: #1773
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
domenic added a commit that referenced this pull request Jul 24, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of #885.

Fixes: #864
Fixes: #885
PR-URL: #1773
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
domenic added a commit that referenced this pull request Jul 30, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of #885.

Fixes: #864
Fixes: #885
PR-URL: #1773
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
domenic added a commit that referenced this pull request Aug 1, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of #885.

Fixes: #864
Fixes: #885
PR-URL: #1773
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
domenic added a commit that referenced this pull request Aug 3, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of #885.

Fixes: #864
Fixes: #885
PR-URL: #1773
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
domenic added a commit that referenced this pull request Aug 4, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of #885.

Fixes: #864
Fixes: #885
PR-URL: #1773
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
domenic added a commit that referenced this pull request Aug 4, 2015
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:

https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU

This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.

Credit to @smikes for the test and the original PR of #885.

Fixes: #864
Fixes: #885
PR-URL: #1773
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants