-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update rule meta data for version 3.16.
- Loading branch information
1 parent
085cfba
commit 20c2a2e
Showing
46 changed files
with
152 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S1186.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,5 @@ <h2>Compliant Solution</h2> | |
for ($i = 0; $i < 10; $i++) { | ||
echo $i; | ||
} | ||
|
||
</pre> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S1603.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 8 additions & 12 deletions
20
php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S2053.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 15 additions & 26 deletions
41
php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S2115.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,23 @@ | ||
<p>Databases should always be password protected. The use of a database connection with an empty password is a clear indication of a database that is | ||
not protected.</p> | ||
<p>This rule flags database connections with empty passwords.</p> | ||
<p>When relying on the password authentication mode for the database connection, a secure password should be chosen.</p> | ||
<p>This rule raises an issue when an empty password is used.</p> | ||
<h2>Noncompliant Code Example</h2> | ||
<pre> | ||
<?php | ||
$servername = "localhost"; | ||
$username = "AppLogin"; | ||
$password = ""; | ||
|
||
// MySQL | ||
$conn = new mysqli($servername, $username, $password); | ||
// MySQL | ||
$conn = mysqli_connect($servername, $username, $password); | ||
// PDO way | ||
$conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password); | ||
// Oracle | ||
$conn = oci_connect($username, $password, "//localhost/orcl"); | ||
// MS SQL Server | ||
$sqlsrvName = "serverName\sqlexpress"; | ||
$sqlsrvConnInfo = array( "Database"=>"myDB", "UID"=>$username, "PWD"=>$password); | ||
$conn = sqlsrv_connect( $sqlsrvName, $sqlsrvConnInfo); | ||
// PosgreSQL | ||
$pgConnInfo = "host=localhost port=5432 dbname=test user=" . $username . " password=" . $password; | ||
$conn = pg_connect($pgConnInfo); | ||
?> | ||
// example of an empty password when connecting to a mysql database | ||
$conn = new mysqli($servername, $username, ""); | ||
</pre> | ||
<h2>Compliant Solution</h2> | ||
<pre> | ||
// generate a secure password, set it to the username database, and store it in a environment variable for instance | ||
$password = getenv('MYSQL_SECURE_PASSWORD'); | ||
// then connect to the database | ||
$conn = new mysqli($servername, $username, $password); | ||
</pre> | ||
<h2>See</h2> | ||
<ul> | ||
<li> <a href="https://www.owasp.org/index.php/Top_10-2017_A3-Sensitive_Data_Exposure">OWASP Top 10 2017 Category A3</a> - Sensitive Data Exposure | ||
</li> | ||
<li> <a href="https://owasp.org/www-project-top-ten/2017/A2_2017-Broken_Authentication.html">OWASP Top 10 2017 Category A2</a> - Broken | ||
Authentication </li> | ||
<li> <a href="https://owasp.org/www-project-top-ten/2017/A3_2017-Sensitive_Data_Exposure">OWASP Top 10 2017 Category A3</a> - Sensitive Data | ||
Exposure </li> | ||
<li> <a href="https://cwe.mitre.org/data/definitions/521.html">MITRE, CWE-521</a> - Weak Password Requirements </li> | ||
</ul> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.