Insecure connection using unencrypted protocol High

Connections that use insecure protocols transmit data in cleartext. This introduces a risk of exposing sensitive data to third parties.

Detector ID
typescript/insecure-connection@v1.0
Category

Noncompliant example

1//Insecure connection using unencrypted protocol
2var net = require("net");
3var socket = new net.Socket();
4function insecureConnectionNoncompliant() {
5  var port = 0;
6  // Noncompliant: host value is not specified.
7  var host = "";
8  var server = socket.connect(port, host);
9}

Compliant example

1
2var net = require("net");
3var socket = new net.Socket();
4function insecureConnectionCompliant() {
5  var port = 0;
6  // Compliant: host value is specified.
7  var host = "192.168.1.1";
8  var server = socket.connect(port, host);
9}