2020-12-21 15:38:52 +01:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
|
|
|
|
== Sensitive Code Example
|
|
|
|
|
2023-01-09 15:29:41 +01:00
|
|
|
[source,csharp]
|
2020-12-21 15:38:52 +01:00
|
|
|
----
|
|
|
|
var urlHttp = "http://example.com"; // Noncompliant
|
|
|
|
var urlFtp = "ftp://anonymous@example.com"; // Noncompliant
|
|
|
|
var urlTelnet = "telnet://anonymous@example.com"; // Noncompliant
|
|
|
|
----
|
|
|
|
|
2023-01-09 15:29:41 +01:00
|
|
|
[source,csharp]
|
2020-12-21 15:38:52 +01:00
|
|
|
----
|
|
|
|
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
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,csharp]
|
2020-12-21 15:38:52 +01:00
|
|
|
----
|
|
|
|
var urlHttps = "https://example.com";
|
|
|
|
var urlSftp = "sftp://anonymous@example.com";
|
|
|
|
var urlSsh = "ssh://anonymous@example.com";
|
|
|
|
----
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,csharp]
|
2020-12-21 15:38:52 +01:00
|
|
|
----
|
|
|
|
using var smtp = new SmtpClient("host", 25) { EnableSsl = true };
|
|
|
|
using var ssh = new MySsh.Client("host", port);
|
|
|
|
----
|
|
|
|
|
|
|
|
include::../exceptions.adoc[]
|
|
|
|
|
|
|
|
include::../see.adoc[]
|
2023-06-22 10:38:01 +02:00
|
|
|
|
2021-09-20 15:38:42 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|