GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — esm: protect ESM loader from prototype pollution by aduh95 · Pull Request #45175 · nodejs/node

Conversation

@aduh95

@aduh95 aduh95 commented Oct 25, 2022

Copy link
Copy Markdown
Contributor

In a previous commit, the loader implementation was modified to be protected against most prototype pollution, but was kept vulnerable to Array.prototype pollution. This commit fixes that, the tradeoff is that it modifies the ESMLoader.prototype.import return type from an Array to an array-like object.

FWIW I don't expect changing the return type of ESMLoader.prototype.import to have any kind of unforeseen consequences, and I don't think it's exposed to user land in any way. //cc @nodejs/loaders

Refs: #45044

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@aduh95
esm: protect ESM loader from prototype pollution
4225d1b
In a previous commit, the loader implementation was modified to be
protected against most prototype pollution, but was kept vulnerable to
`Array.prototype` pollution. This commit fixes that, the tradeoff is
that it modifies the `ESMLoader.prototype.import` return type from an
`Array` to an array-like object.

Refs: nodejs#45044
@nodejs-github-bot

nodejs-github-bot commented Oct 25, 2022

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/modules
  • @nodejs/tsc
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Oct 25, 2022
ljharb
ljharb requested changes Oct 25, 2022
View reviewed changes
Comment thread lib/internal/per_context/primordials.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/internal/per_context/primordials.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/internal/per_context/primordials.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

aduh95 added 2 commits October 25, 2022 20:14
@aduh95
fixup! esm: protect ESM loader from prototype pollution
d82537b
@aduh95
fixup! fixup! esm: protect ESM loader from prototype pollution
00f3c45
ljharb
ljharb reviewed Oct 25, 2022
View reviewed changes
Comment thread lib/internal/per_context/primordials.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/internal/per_context/primordials.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/internal/per_context/primordials.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aduh95
fixup! esm: protect ESM loader from prototype pollution
f93851d
ljharb
ljharb approved these changes Oct 26, 2022
View reviewed changes
GeoffreyBooth
GeoffreyBooth approved these changes Oct 26, 2022
View reviewed changes

@GeoffreyBooth GeoffreyBooth left a comment

Copy link
Copy Markdown
Member

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.

LGTM.

Out of scope for this PR, but should we have tests that things like our primordial PromisePrototypeAll behaves equivalently to Promise.all? Maybe an identical expected result from each in a test, where we wouldn’t have to worry about prototype pollution?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ljharb and aduh95 reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@aduh95 aduh95 added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Oct 26, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 26, 2022
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
mcollina
mcollina approved these changes Oct 26, 2022
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

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.

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
aduh95
aduh95 commented Oct 26, 2022
View reviewed changes
Comment thread lib/internal/per_context/primordials.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aduh95
Update lib/internal/per_context/primordials.js
ae20149
@nodejs-github-bot

nodejs-github-bot commented Oct 26, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/47496/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Oct 26, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/47498/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Oct 27, 2022
CI Reliability 2022-10-27 nodejs/reliability#412
Open
13 tasks
anonrig
anonrig approved these changes Oct 27, 2022
View reviewed changes
@aduh95 aduh95 added commit-queue PRs queued for automated landing through the Commit Queue. commit-queue-squash PRs the Commit Queue should land as one squashed commit. labels Oct 27, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Oct 27, 2022
@nodejs-github-bot
nodejs-github-bot merged commit 2e2dc99 into nodejs:main Oct 27, 2022
@nodejs-github-bot

nodejs-github-bot commented Oct 27, 2022

Copy link
Copy Markdown
Collaborator

Landed in 2e2dc99

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95
aduh95 deleted the esm-no-prototype-pollution branch October 27, 2022 20:11
@aduh95 aduh95 mentioned this pull request Oct 27, 2022
fs: add recursive watch for linux #45098
Merged
5 tasks done
@github-actions github-actions Bot mentioned this pull request Oct 28, 2022
CI Reliability 2022-10-28 nodejs/reliability#413
Open
10 tasks
This was referenced Oct 29, 2022
CI Reliability 2022-10-29 nodejs/reliability#414
Open
CI Reliability 2022-10-30 nodejs/reliability#415
Open
CI Reliability 2022-10-31 nodejs/reliability#416
Open
RafaelGSS pushed a commit that referenced this pull request Nov 1, 2022
@aduh95 @RafaelGSS
esm: protect ESM loader from prototype pollution
f48b51a
In a previous commit, the loader implementation was modified to be
protected against most prototype pollution, but was kept vulnerable to
`Array.prototype` pollution. This commit fixes that, the tradeoff is
that it modifies the `ESMLoader.prototype.import` return type from an
`Array` to an array-like object.

Refs: #45044
PR-URL: #45175
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Nov 1, 2022
v19.1.0 proposal #45269
Merged
RafaelGSS pushed a commit that referenced this pull request Nov 10, 2022
@aduh95 @RafaelGSS
esm: protect ESM loader from prototype pollution
40a5e22
In a previous commit, the loader implementation was modified to be
protected against most prototype pollution, but was kept vulnerable to
`Array.prototype` pollution. This commit fixes that, the tradeoff is
that it modifies the `ESMLoader.prototype.import` return type from an
`Array` to an array-like object.

Refs: #45044
PR-URL: #45175
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
@danielleadams danielleadams mentioned this pull request Dec 30, 2022
v18.13.0 release proposal #46025
Merged
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
@aduh95 @danielleadams
esm: protect ESM loader from prototype pollution
61d05e4
In a previous commit, the loader implementation was modified to be
protected against most prototype pollution, but was kept vulnerable to
`Array.prototype` pollution. This commit fixes that, the tradeoff is
that it modifies the `ESMLoader.prototype.import` return type from an
`Array` to an array-like object.

Refs: #45044
PR-URL: #45175
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@aduh95 @danielleadams
esm: protect ESM loader from prototype pollution
2f27d05
In a previous commit, the loader implementation was modified to be
protected against most prototype pollution, but was kept vulnerable to
`Array.prototype` pollution. This commit fixes that, the tradeoff is
that it modifies the `ESMLoader.prototype.import` return type from an
`Array` to an array-like object.

Refs: #45044
PR-URL: #45175
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
@tniessen tniessen mentioned this pull request Apr 22, 2023
test_runner: fix test runner concurrency #47675
Closed
@alan-agius4 alan-agius4 mentioned this pull request Jun 2, 2023
fix(zone.js): patch entire promise in node angular/angular#50552
Closed
alan-agius4 added a commit to alan-agius4/angular that referenced this pull request Jun 2, 2023
@alan-agius4
fix(zone.js): patch entire promise in node
88bb6e8
In angular#49144 we introduced a change to only path `Promise.prototype.then` due to Node.js `SafePromise` complaining about `Promise.prototype.then` called on incompatible receiver. This however introduced a number of regressions. This commit reverts this change and re-introduces the changes to patch the entire promise on Node.

The original `SafePromise` problem is no longer reproducible as of Node.js version 18.13+ as it was addressed as part of nodejs/node#45175.

While the Angular CLI does not yet generate ESM server bundles, users using ESM with dynamic imports will require using Node.js 18.13 or later.

Closes angular#50513, closes angular#50457, closes angular#50414 and closes angular#49930
alxhub pushed a commit to angular/angular that referenced this pull request Jun 2, 2023
@alan-agius4 @alxhub
fix(zone.js): patch entire promise in node (#50552)
cb31dbc
In #49144 we introduced a change to only path `Promise.prototype.then` due to Node.js `SafePromise` complaining about `Promise.prototype.then` called on incompatible receiver. This however introduced a number of regressions. This commit reverts this change and re-introduces the changes to patch the entire promise on Node.

The original `SafePromise` problem is no longer reproducible as of Node.js version 18.13+ as it was addressed as part of nodejs/node#45175.

While the Angular CLI does not yet generate ESM server bundles, users using ESM with dynamic imports will require using Node.js 18.13 or later.

Closes #50513, closes #50457, closes #50414 and closes #49930

PR Close #50552
alxhub pushed a commit to angular/angular that referenced this pull request Jun 2, 2023
@alan-agius4 @alxhub
fix(zone.js): patch entire promise in node (#50552)
9d7991a
In #49144 we introduced a change to only path `Promise.prototype.then` due to Node.js `SafePromise` complaining about `Promise.prototype.then` called on incompatible receiver. This however introduced a number of regressions. This commit reverts this change and re-introduces the changes to patch the entire promise on Node.

The original `SafePromise` problem is no longer reproducible as of Node.js version 18.13+ as it was addressed as part of nodejs/node#45175.

While the Angular CLI does not yet generate ESM server bundles, users using ESM with dynamic imports will require using Node.js 18.13 or later.

Closes #50513, closes #50457, closes #50414 and closes #49930

PR Close #50552
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
@alan-agius4 @ChellappanRajan
fix(zone.js): patch entire promise in node (angular#50552)
0fe31db
In angular#49144 we introduced a change to only path `Promise.prototype.then` due to Node.js `SafePromise` complaining about `Promise.prototype.then` called on incompatible receiver. This however introduced a number of regressions. This commit reverts this change and re-introduces the changes to patch the entire promise on Node.

The original `SafePromise` problem is no longer reproducible as of Node.js version 18.13+ as it was addressed as part of nodejs/node#45175.

While the Angular CLI does not yet generate ESM server bundles, users using ESM with dynamic imports will require using Node.js 18.13 or later.

Closes angular#50513, closes angular#50457, closes angular#50414 and closes angular#49930

PR Close angular#50552
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ljharb ljharb ljharb approved these changes
@mcollina mcollina mcollina approved these changes
@GeoffreyBooth GeoffreyBooth GeoffreyBooth approved these changes
@anonrig anonrig anonrig approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-squash PRs the Commit Queue should land as one squashed commit. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@aduh95 @nodejs-github-bot @ljharb @mcollina @GeoffreyBooth @anonrig
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.