36 lines
908 B
Plaintext
36 lines
908 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
include::../ask-yourself.adoc[]
|
||
|
|
||
|
include::../recommended.adoc[]
|
||
|
|
||
|
== Sensitive Code Example
|
||
|
|
||
|
----
|
||
|
var urlHttp = "http://example.com"; // Noncompliant
|
||
|
var urlFtp = "ftp://anonymous@example.com"; // Noncompliant
|
||
|
var urlTelnet = "telnet://anonymous@example.com"; // Noncompliant
|
||
|
----
|
||
|
|
||
|
----
|
||
|
using var smtp = new SmtpClient("host", 25); // Noncompliant, EnableSsl is not set
|
||
|
using var telnet = new MyTelnet.Client("host", port); // Noncompliant, rule raises Security Hotspot on any member containing "Telnet"
|
||
|
----
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
var urlHttps = "https://example.com";
|
||
|
var urlSftp = "sftp://anonymous@example.com";
|
||
|
var urlSsh = "ssh://anonymous@example.com";
|
||
|
----
|
||
|
|
||
|
----
|
||
|
using var smtp = new SmtpClient("host", 25) { EnableSsl = true };
|
||
|
using var ssh = new MySsh.Client("host", port);
|
||
|
----
|
||
|
|
||
|
include::../exceptions.adoc[]
|
||
|
|
||
|
include::../see.adoc[]
|