2020-06-30 14:41:58 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
|
|
|
|
== Sensitive Code Example
|
|
|
|
|
|
|
|
----
|
2021-02-16 10:34:10 +01:00
|
|
|
$hash = md5($data); // Sensitive
|
|
|
|
$hash = sha1($data); // Sensitive
|
2020-06-30 14:41:58 +02:00
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,php]
|
2020-06-30 14:41:58 +02:00
|
|
|
----
|
2021-02-16 10:34:10 +01:00
|
|
|
// for a password
|
|
|
|
$hash = password_hash($password, PASSWORD_BCRYPT); // Compliant
|
|
|
|
|
|
|
|
// other context
|
|
|
|
$hash = hash("sha512", $data);
|
2020-06-30 14:41:58 +02:00
|
|
|
----
|
|
|
|
|
|
|
|
include::../see.adoc[]
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== 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[]
|
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|