Skip to content

proposal: --no-inspect-json-endpoint #303

Closed
@alexkozy

Description

@alexkozy

During last diagnostics WG meeting @ofrobots raised a question about is it safe to use --inspect or --inspect-brk in production.

If we have more then one node instance running in the same environment, it should not be possible by default to connect from one instance to another instance using inspector WebSocket. Connection to inspector requires full web socket url, ws://<ip>:<port>/<unguessable token> . Example of unguessable token is 5b19ecae-c62e-4f26-a43a-e3d1f680e091, it is generated in a way that external client can not guess it.

Currently there are three ways to get this token out of Node process:

  • parse process stderr, it requires control over the app start,
  • sending http.get request to <ip>:<port>/json/list,
  • require('inspect').url(), it returns only url for current node process, if we can run this code it means that we can run anything.

Guessing port is much simpler task than guessing unguessable token. Any process can guess it and get full WebSocket url using json endpoint. At the same time json endpoint is used by different tools, e.g. Chrome DevTools or chrome-remote-interface so we can not remove it all together.

Based on this idea, I'd like to propose: --no-inspect-json-endpoint flag, it disables inspector json endpoint.

Later we can disable it by default and introduce --inspect-json-endpoint. This change will break some clients but sounds safer to me.

@ofrobots @eugeneo what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions