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

process: disallow some uses of Object.defineProperty() on process.env #28006

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

@Himself65
Copy link
Member

@Himself65 Himself65 commented Jun 1, 2019

try to fix #27990

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Copy link
Member

@addaleax addaleax left a comment

I’m labelling this semver-major because it adds a throw, but I don’t have a strong opinion on that and we can remove it if somebody feels differently.

src/node_env_var.cc Outdated Show resolved Hide resolved
doc/api/process.md Outdated Show resolved Hide resolved
Trott
Trott approved these changes Jun 1, 2019
Copy link
Member

@Trott Trott left a comment

LGTM if CI is green. (I think I'd prefer that we throw an error with a code property, but that can always be changed later.)

@nodejs-github-bot

This comment has been hidden.

@Himself65 Himself65 force-pushed the 27990 branch 2 times, most recently from d30c5e6 to 40bdd0c Jun 2, 2019
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Jun 3, 2019

Copy link
Member

@bnoordhuis bnoordhuis left a comment

LGTM % comment.

src/node_env_var.cc Outdated Show resolved Hide resolved
@Himself65 Himself65 force-pushed the 27990 branch 13 times, most recently from 5d63629 to 6b9d9cb Jun 3, 2019
src/node_env_var.cc Outdated Show resolved Hide resolved
src/node_env_var.cc Outdated Show resolved Hide resolved
@Himself65 Himself65 force-pushed the 27990 branch 2 times, most recently from 75fa512 to 59b5175 Jun 5, 2019
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Dec 1, 2020

@gireeshpunathil
Copy link
Member

@gireeshpunathil gireeshpunathil commented Dec 1, 2020

sorry - missed to see the latest review comments

@aduh95
Copy link
Contributor

@aduh95 aduh95 commented Mar 9, 2021

Is this ready to land?

Copy link
Member

@ljharb ljharb left a comment

I think an error message would be clearer if it explicitly said something like “process.env only supports a configurable, writable, enumerable data property”

test/parallel/test-process-env-ignore-getter-setter.js Outdated Show resolved Hide resolved
{
code: 'ERR_INVALID_OBJECT_DEFINE_PROPERTY',
name: 'TypeError',
message: 'Must set all attributes with true to \'value\' ' +
Copy link
Member

@ljharb ljharb Mar 10, 2021

Choose a reason for hiding this comment

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

also this one

@bnb
Copy link
Member

@bnb bnb commented Jan 11, 2022

@Himself65 any chance you're still around to address @ljharb's comments and get this ready to land? ❤️

@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Jan 11, 2022

Ok, i will take a look

Disallow the use of Object.defineProperty() to hide entries in
process.env or make them immutable.
src/node_env_var.cc Outdated Show resolved Hide resolved
src/node_env_var.cc Outdated Show resolved Hide resolved
src/node_env_var.cc Outdated Show resolved Hide resolved
@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Jan 12, 2022

hope the test will pass

@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Jan 12, 2022

Download action repository 'actions/checkout@v2' (SHA:ec3a7ce113134d7a93b817d10a8272cb61118579)
Warning: Failed to download action 'https://api.github.com/repos/actions/checkout/tarball/ec3a7ce113134d7a93b817d10a8272cb61118579'. Error: Response status code does not indicate success: 503 (Service Unavailable).
Warning: Back off 25.2 seconds before retry.
Warning: Failed to download action 'https://api.github.com/repos/actions/checkout/tarball/ec3a7ce113134d7a93b817d10a8272cb61118579'. Error: Response status code does not indicate success: 503 (Service Unavailable).
Warning: Back off 12.773 seconds before retry.
Error: Response status code does not indicate success: 503 (Service Unavailable).

@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Jan 12, 2022

why all ci crash and only happen in my pr?

@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Jan 12, 2022

why all ci crash and only happen in my pr?

https://www.githubstatus.com/incidents/cypv026dr23w

@Himself65
Copy link
Member Author

@Himself65 Himself65 commented Jan 13, 2022

@ljharb could u please take a look? thanks

@ljharb
Copy link
Member

@ljharb ljharb commented Jan 13, 2022

LGTM!

doc/api/errors.md Outdated Show resolved Hide resolved
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95
aduh95 approved these changes Jan 14, 2022
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Jan 14, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment