-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
src: add security warning when inspector is running on public network #23756
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,67 @@ | ||||||||||||||||||||||||||||
'use strict'; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
const dns = require('dns'); | ||||||||||||||||||||||||||||
const util = require('util'); | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
const lookup = util.promisify(dns.lookup); | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
const IP_RANGES = { | ||||||||||||||||||||||||||||
local: 'LOCAL', | ||||||||||||||||||||||||||||
private: 'PRIVATE', | ||||||||||||||||||||||||||||
public: 'PUBLIC' | ||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
function isValidIpV4(parts) { | ||||||||||||||||||||||||||||
|
function isIPv4(s) { | |
return IPv4Reg.test(s); | |
} | |
function isIPv6(s) { | |
return IPv6Reg.test(s); | |
} | |
function isIP(s) { | |
if (isIPv4(s)) return 4; | |
if (isIPv6(s)) return 6; | |
return 0; | |
} |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This warning does not describe the actual implications and doesn't tell the user what the actual problem is.
How about
In case if port ${port} is not filtered on your machine by a firewall, anyone in the same
private network ${subnet} could access your setup and perform a remote code execution.
Subnet could be taken from os.networkInterfaces()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about other loopback addresses? What about IPv6?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a guard against default value that is here, even when the user does not run node with inspect parameter