rspec/rules/S4721/csharp/rule.adoc

28 lines
538 B
Plaintext
Raw Normal View History

2020-06-30 12:49:37 +02:00
include::../description.adoc[]
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
== Sensitive Code Example
----
public void SensitiveExample() {
String cmd="file.exe";
var startInfo = new ProcessStartInfo();
startInfo.FileName = cmd; // Sensitive: file.exe will be search in PATH directories
}
----
== Compliant Solution
----
public void CompliantExample() {
String cmd="/usr/bin/file.exe";
var startInfo = new ProcessStartInfo();
startInfo.FileName = cmd; // Compliant
}
----
include::../see.adoc[]