镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Warn on insecure environment options / CLI flags #21774

Description

@ChALkeR

Note: this is not about deprecation, it is about printing runtime warnings about security impact of some of the Node.js environment options. That would probably be a semver-major change.

Environment options are more dangereous because:

  • It is very simple to blindly copy-paste suggestions from the internet without understanding the security impact — more simple than writing unsafe code.
  • Users are more likely to blindly run some programs (like npm) with those than modify them to use unsafe API.
  • User might not even know that they are using unsafe env options: other appliations, stale/corrupted env, some libraries from npm — those all can set unsafe env options without user noticing that.

I have seen npm credentials in logs from npm being run with NODE_DEBUG=http and those logs being attached to issues.
I have seen modules setting NODE_TLS_REJECT_UNAUTHORIZED.

So far, the ones that I am aware of:

Anything else?

I also would like some discussion here, as I am not sure if that is the best approach in this situation.
/cc @nodejs/security-wg

Activity

  1. added
    discussIssues opened for discussion and feedback.
    securityIssues and PRs related to security.
    on Jul 11, 2018
  2. changed the title [-]Warn on insecure Node.js environment options / CLI flags[/-] [+]Warn on insecure environment options / CLI flags[/+] on Jul 12, 2018
  3. mcollina commented on Jul 12, 2018

    @mcollina
    SponsorMember

    I'm in favor of such a change.

    I also think that we might not want to allow to change NODE_DEBUG and NODE_TLS_REJECT_UNAUTHORIZED at runtime, or that we should sample those values at startup.

  4. jasnell commented on Jul 12, 2018

    @jasnell
    Member

    I've wanted these kinds of warnings since I introduced emitWarning. It was part of my original use case for it. Big +1

  5. addaleax commented on Jul 12, 2018

    @addaleax
    Member

    I’m on board with warnings for all three situations you’re suggesting.

    I don’t think we need to prohibit programmatic usage, though. Printing a warning is already close enough to effectively break a feature in a lot of circumstances.

  6. vdeturckheim commented on Jul 12, 2018

    @vdeturckheim
    Member

    This would definitly make sense to me 👍

  7. MarcinHoppe commented on Jul 19, 2018

    @MarcinHoppe

    👍 from me, too. Developers and operations people alike might not be aware of but hopefully a warning will be picked up by any monitoring / alerting system in use.

    Should we also include an option to suppress this warning for people who have a legitimate reason to run with this setting?

  8. ChALkeR commented on Jul 19, 2018

    @ChALkeR
    MemberAuthor

    @MarcinHoppe There is already an --no-warnings option to suppress warnings from Node.js, that should suppress these too.

    I am not sure if there needs to be a one to suppress just these kind of warnings (or perhaps even a specific warning only). I don't want to overengineer it from the start, so perhaps it would make sense to add that in case if someone who would actually need it asks?

  9. MarcinHoppe commented on Jul 20, 2018

    @MarcinHoppe

    I don't want to overengineer it from the start, so perhaps it would make sense to add that in case if someone who would actually need it asks?

    I wholeheartedly endorse this approach :). 👍 from me.

  10. BridgeAR commented on Jul 23, 2018

    @BridgeAR
    Member

    To me this is somewhat related to #21424.

  11. ChALkeR commented on Oct 12, 2018

    @ChALkeR
    MemberAuthor

    --inspect extracted to #23444.

    As this has been open for some time and there are no new ideas, closing.

    Feel free to reopen if you have some more ideas to propose (alternatively — filing a separate issue would also be great)!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussIssues opened for discussion and feedback.securityIssues and PRs related to security.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions