rspec/rules/S5144/php/rule.adoc
2020-06-30 17:16:12 +02:00

25 lines
363 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
----
$url = $_GET["url"];
$resp = file_get_contents($url); // Noncompliant
// ...
----
== Compliant Solution
----
$whitelist = array(
"https://www.sonarsource.com"
);
$url = $_GET["url"];
if (in_array($url, $whitelist)) {
$resp = file_get_contents($url);
// ...
}
----
include::../see.adoc[]