Skip to content

Double wrap Objects#242

Merged
patriksimek merged 2 commits intopatriksimek:masterfrom
XmiliaH:fix-241
Sep 13, 2019
Merged

Double wrap Objects#242
patriksimek merged 2 commits intopatriksimek:masterfrom
XmiliaH:fix-241

Conversation

@XmiliaH
Copy link
Copy Markdown
Collaborator

@XmiliaH XmiliaH commented Sep 13, 2019

Since node's inspect used by console.log strips one layer of proxys, wrap it in two.
The inner one uses a simple shared handler. Fixes #241.
Also allow to connect a host object with a sandbox object. This allowes to override the Buffer.prototype.inspect method with a safer, in sandbox one, fixes #187 for now, however we should have a look if other objects expose a custom inspect method.

Since node's inspect used by console.log strips one layer of proxys, wrap it in two.
The inner one uses a simple shared handler. Fixes patriksimek#241.
Also allow to connect a host object with a sandbox offset. This allowes to override the Buffer.prototype.inspect method with a saver, in sandbox one, fixes patriksimek#187 for now, however we should have a look if other objects expose a custom inspect method.
@XmiliaH
Copy link
Copy Markdown
Collaborator Author

XmiliaH commented Sep 13, 2019

I want to note here that I don't like the double wrapping, but I have no better idea to fix this.

@XmiliaH XmiliaH requested a review from patriksimek September 13, 2019 21:25
@patriksimek patriksimek merged commit fe2bdf3 into patriksimek:master Sep 13, 2019
@patriksimek
Copy link
Copy Markdown
Owner

Thanks, I like the double-proxy solution. Pretty smart.

@XmiliaH
Copy link
Copy Markdown
Collaborator Author

XmiliaH commented Sep 13, 2019

However, this is based on nodes internals, which may change. Should add a test to notice when they decide to unwrapp a object until there is no more proxy around it instead of only one.

@XmiliaH XmiliaH deleted the fix-241 branch September 13, 2019 23:04
@XmiliaH XmiliaH mentioned this pull request Mar 1, 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

Development

Successfully merging this pull request may close these issues.

Breakout with console.log Inspect Escape [Node.js 11.8.0]

2 participants