rspec/rules/S4790/php/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

57 lines
1.2 KiB
Plaintext

include::../description.adoc[]
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
== Sensitive Code Example
----
$hash = md5($data); // Sensitive
$hash = sha1($data); // Sensitive
----
== Compliant Solution
[source,php]
----
// for a password
$hash = password_hash($password, PASSWORD_BCRYPT); // Compliant
// other context
$hash = hash("sha512", $data);
----
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)
=== on 17 Oct 2018, 17:49:50 Nicolas Harraudeau wrote:
*Out of scope*:
All the following functions are out of scope:
* Hashing files is not usually performed to hide sensitive content.
** http://php.net/manual/en/function.hash-file.php[hash_file]
** http://php.net/manual/en/function.md5-file.php[md5_file]
** http://php.net/manual/en/function.sha1-file.php[sha1_file]
** http://php.net/manual/en/function.hash-hmac-file.php[hash_hmac_file]
* HMAC is is out of scope of this RSPEC
** http://php.net/manual/en/function.hash-hmac.php[hash_hmac]
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]