rspec/rules/S5122/php/rule.adoc

78 lines
1.4 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
2022-02-04 17:28:24 +01:00
[source,php]
2020-06-30 12:50:28 +02:00
----
header("Access-Control-Allow-Origin: $trusteddomain"); // Compliant
----
Laravel
2022-02-04 17:28:24 +01:00
[source,php]
----
response()->header('Access-Control-Allow-Origin', $trusteddomain); /// Compliant
----
Symfony
2022-02-04 17:28:24 +01:00
[source,php]
----
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[]