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

Closed
zcbenz opened this issue Dec 20, 2023 · 3 comments · Fixed by #52905
Closed
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

nodejs-github-bot pushed a commit that referenced this issue May 23, 2024
PR-URL: #52905
Fixes: #51227
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
targos pushed a commit that referenced this issue Jun 1, 2024
PR-URL: #52905
Fixes: #51227
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
EliphazBouye pushed a commit to EliphazBouye/node that referenced this issue Jun 20, 2024
PR-URL: nodejs#52905
Fixes: nodejs#51227
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
bmeck pushed a commit to bmeck/node that referenced this issue Jun 22, 2024
PR-URL: nodejs#52905
Fixes: nodejs#51227
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
marco-ippolito pushed a commit that referenced this issue Jul 19, 2024
PR-URL: #52905
Fixes: #51227
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
marco-ippolito pushed a commit that referenced this issue Jul 19, 2024
PR-URL: #52905
Fixes: #51227
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
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