-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
deps: cherry-pick 0bcb1d6f from upstream V8 #18212
Conversation
It should be noted that this flag has no impact on const eval = vm.runInThisContext;
n = 1;
eval('n++');
// n == 2 |
@jasnell do you think it might make sense to create a node specific flag that enables not only this flag but stops the ability to execute code in other fashions as well? |
@MylesBorins If that were done, there would need to be some other way of loading code for require, or some kind of whitelist, or a Symbol passed in or something to give the require logic the ability to https://github.com/nodejs/node/blob/master/lib/module.js#L628 |
Yep, given our internal reliance on |
@jasnell "this" as in this specific PR or a future PR? |
Perhaps a second commit in this PR? Not sure exactly where that should go. Maybe in the cli.md or in vm.md. |
I faintly remember that this would also disable wasm. Do you want to make sure? Does that match your expectation? |
Would this block new Function() as well? I prefer not to spread bad information that running with this flag is the way to go to improve security. |
That shouldn't be affected, Aside: |
Yes. Otherwise you could just use that to bypass eval. |
Absolutely agree. It's a good flag to have, but promoting it as a security mechanism is just a facade. Like locking the front door while leaving all the windows and the back door open with signs that say "Free Cookies Inside" |
Where do we stand here? There is also #18453 that probably already included this as well? |
I'm not sure what we should do regarding documentation of this feature. Would it make sense to wait for 6.5? I was thinking it might make sense to cherry-pick to 8.x in a future semver-minor. This is the beginning of a larger story around locking down eval. should we land this as is? |
92c198f
to
070dc97
Compare
CI is green and I have 3 LGTMs. Are people ok with this landing without any documentation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update lib/internal/v8_prof_processor.js
to use vm.runInThisContext()
instead of eval()
?
PR-URL: nodejs#18623 Refs: nodejs#18212 (review) Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Original commit message: Introduce --disallow-code-generation-from-strings Exposing the existing Context::AllowCodeGenerationFromStrings(false) API to the command line. Bug: v8:7134 Change-Id: I062ccff0b03c5bcf6878c41c455c0ded37a1d743 Reviewed-on: https://chromium-review.googlesource.com/809631 Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/master@{nodejs#49911} Refs: v8/v8@0bcb1d6
070dc97
to
af019e5
Compare
@bnoordhuis 99d693d has landed on master @jasnell thoughts re: skipping docs? |
PR-URL: #18623 Refs: #18212 (review) Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #18623 Refs: #18212 (review) Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #18623 Refs: #18212 (review) Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
ping @bnoordhuis and @jasnell |
I signed off. I'd still prefer the doc addition. |
@jasnell more than happy to add the doc addition but struggling to figure out the right place to do it, do you have any suggestions? |
since i'm not seeing anything actionable on where to add the docs I'm going to go ahead and land this. |
Original commit message: Introduce --disallow-code-generation-from-strings Exposing the existing Context::AllowCodeGenerationFromStrings(false) API to the command line. Bug: v8:7134 Change-Id: I062ccff0b03c5bcf6878c41c455c0ded37a1d743 Reviewed-on: https://chromium-review.googlesource.com/809631 Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/master@{#49911} PR-URL: #18212 Refs: v8/v8@0bcb1d6 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Original commit message: Introduce --disallow-code-generation-from-strings Exposing the existing Context::AllowCodeGenerationFromStrings(false) API to the command line. Bug: v8:7134 Change-Id: I062ccff0b03c5bcf6878c41c455c0ded37a1d743 Reviewed-on: https://chromium-review.googlesource.com/809631 Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/master@{#49911} PR-URL: #18212 Refs: v8/v8@0bcb1d6 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Original commit message: Introduce --disallow-code-generation-from-strings Exposing the existing Context::AllowCodeGenerationFromStrings(false) API to the command line. Bug: v8:7134 Change-Id: I062ccff0b03c5bcf6878c41c455c0ded37a1d743 Reviewed-on: https://chromium-review.googlesource.com/809631 Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/master@{#49911} PR-URL: #18212 Refs: v8/v8@0bcb1d6 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Original commit message: Introduce --disallow-code-generation-from-strings Exposing the existing Context::AllowCodeGenerationFromStrings(false) API to the command line. Bug: v8:7134 Change-Id: I062ccff0b03c5bcf6878c41c455c0ded37a1d743 Reviewed-on: https://chromium-review.googlesource.com/809631 Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/master@{#49911} PR-URL: #18212 Refs: v8/v8@0bcb1d6 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Original commit message: Introduce --disallow-code-generation-from-strings Exposing the existing Context::AllowCodeGenerationFromStrings(false) API to the command line. Bug: v8:7134 Change-Id: I062ccff0b03c5bcf6878c41c455c0ded37a1d743 Reviewed-on: https://chromium-review.googlesource.com/809631 Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/master@{#49911} PR-URL: #18212 Refs: v8/v8@0bcb1d6 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Original commit message: Introduce --disallow-code-generation-from-strings Exposing the existing Context::AllowCodeGenerationFromStrings(false) API to the command line. Bug: v8:7134 Change-Id: I062ccff0b03c5bcf6878c41c455c0ded37a1d743 Reviewed-on: https://chromium-review.googlesource.com/809631 Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/master@{#49911} PR-URL: #18212 Refs: v8/v8@0bcb1d6 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
PR-URL: nodejs#18623 Refs: nodejs#18212 (review) Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Original commit message: Introduce --disallow-code-generation-from-strings Exposing the existing Context::AllowCodeGenerationFromStrings(false) API to the command line. Bug: v8:7134 Change-Id: I062ccff0b03c5bcf6878c41c455c0ded37a1d743 Reviewed-on: https://chromium-review.googlesource.com/809631 Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/master@{nodejs#49911} PR-URL: nodejs#18212 Refs: v8/v8@0bcb1d6 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
PR-URL: #18623 Refs: #18212 (review) Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #18623 Refs: #18212 (review) Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
This has landed in 6.5, but we shouldn't have to wait!
Original commit message:
Refs: v8/v8@0bcb1d6