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

The kDisableNodeOptionsEnv option can be work around by using NODE_REPL_EXTERNAL_MODULE env #51227

Open
zcbenz opened this issue Dec 20, 2023 · 3 comments · May be fixed by #52905
Open

The kDisableNodeOptionsEnv option can be work around by using NODE_REPL_EXTERNAL_MODULE env #51227

zcbenz opened this issue Dec 20, 2023 · 3 comments · May be fixed by #52905
Labels
security Issues and PRs related to security.

Comments

@zcbenz
Copy link
Contributor

zcbenz commented Dec 20, 2023

Node has an kDisableNodeOptionsEnv embedder flag that disables NODE_OPTIONS env to avoid injecting external code into apps, however it can be bypassed by using the NODE_REPL_EXTERNAL_MODULE env as reported by electron/electron#40770.

I understand kDisableNodeOptionsEnv only means to disable NODE_OPTIONS env, but if we don't also disable NODE_REPL_EXTERNAL_MODULE the protection would become meaningless.

I think we have 2 options to fix this:

  1. Disable NODE_REPL_EXTERNAL_MODULE env when kDisableNodeOptionsEnv is used.
  2. Deprecate kDisableNodeOptionsEnv and add a new flag that disables all possible ways to inject code.

I wonder which one would be preferred by Node team. /cc @addaleax @joyeecheung @bnoordhuis

@RedYetiDev
Copy link
Member

@nodejs/security-wg

@RedYetiDev RedYetiDev added the dotenv Issues and PRs related to .env file parsing label Apr 26, 2024
@RedYetiDev
Copy link
Member

RedYetiDev commented Apr 26, 2024

Dotenv isn't the correct label (no dotenv file), buts AFAIK the closest to env variables

@RedYetiDev RedYetiDev added the security Issues and PRs related to security. label Apr 26, 2024
@RafaelGSS RafaelGSS removed the dotenv Issues and PRs related to .env file parsing label Apr 29, 2024
@RafaelGSS
Copy link
Member

RafaelGSS commented Apr 29, 2024

@zcbenz While the first option is trivial I assume it will be a breaking change for all users that rely on the current behavior. I believe a new flag should be a safer approach. Honestly, I'm fine with both options.

cc: @nodejs/tsc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security Issues and PRs related to security.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants