52 lines
926 B
Plaintext
52 lines
926 B
Plaintext
include::../description.adoc[]
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
== Sensitive Code Example
|
|
|
|
----
|
|
public function loadTwig()
|
|
{
|
|
$twig = new \Twig_Environment(new \Twig_Loader_String(), [
|
|
'autoescape' => false, // Sensitive
|
|
]);
|
|
|
|
$escaper = new \Twig_Extension_Escaper(false); // Sensitive
|
|
$twig->addExtension($escaper);
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[source,php]
|
|
----
|
|
public function loadTwig()
|
|
{
|
|
$twig = new \Twig_Environment(new \Twig_Loader_String(), [
|
|
'autoescape' => true, // Compliant
|
|
]);
|
|
|
|
$escaper = new \Twig_Extension_Escaper(true); // Compliant
|
|
$twig->addExtension($escaper);
|
|
}
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|