rspec/rules/S5122/php/rule.adoc

75 lines
1.3 KiB
Plaintext
Raw Normal View History

2020-06-30 12:50:28 +02:00
include::../description.adoc[]
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
== Sensitive Code Example
----
header("Access-Control-Allow-Origin: *"); // Sensitive
----
Laravel
----
response()->header('Access-Control-Allow-Origin', "*"); // Sensitive
----
Symfony
----
use Symfony\Component\HttpFoundation\Response;
$response = new Response(
'Content',
Response::HTTP_OK,
['Access-Control-Allow-Origin' => '*'] // Sensitive
);
$response->headers->set('Access-Control-Allow-Origin', '*'); // Sensitive
----
2020-06-30 12:50:28 +02:00
== Compliant Solution
----
header("Access-Control-Allow-Origin: $trusteddomain"); // Compliant
----
Laravel
----
response()->header('Access-Control-Allow-Origin', $trusteddomain); /// Compliant
----
Symfony
----
use Symfony\Component\HttpFoundation\Response;
$response = new Response(
'Content',
Response::HTTP_OK,
['Access-Control-Allow-Origin' => $trusteddomain] /// Compliant
$response->headers->set('Access-Control-Allow-Origin',$trusteddomain); // Compliant
2020-06-30 12:50:28 +02:00
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]