Skip to content

Commit 84c7213

Browse files
Update rule metadata
1 parent f9c881a commit 84c7213

File tree

6 files changed

+26
-10
lines changed

6 files changed

+26
-10
lines changed

php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S122.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
<h2>Why is this an issue?</h2>
22
<p>Putting multiple statements on a single line lowers the code readability and makes debugging the code more complex.</p>
33
<pre>
4-
if (someCondition) doSomething(); // Noncompliant
4+
if (someCondition) { doSomething(); } // Noncompliant
5+
6+
doSomething(); doSomethingElse(); // Noncompliant
57
</pre>
68
<p>Write one statement per line to improve readability.</p>
79
<pre>
810
if (someCondition) {
911
doSomething();
1012
}
13+
14+
doSomething();
15+
doSomethingElse();
1116
</pre>
1217
<h3>Exceptions</h3>
1318
<p>The rule ignores anonymous functions containing a single statement.</p>

php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S2068.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@ <h2>Why is this an issue?</h2>
33
open-source applications. This practice exposes your application to significant security risks.</p>
44
<p>This rule flags instances of hard-coded credentials used in database and LDAP connections. It looks for hard-coded credentials in connection
55
strings, and for variable names that match any of the patterns from the provided list.</p>
6+
<p>In the past, it has led to the following vulnerabilities:</p>
7+
<ul>
8+
<li> <a href="https://www.cve.org/CVERecord?id=CVE-2019-13466">CVE-2019-13466</a> </li>
9+
<li> <a href="https://www.cve.org/CVERecord?id=CVE-2018-15389">CVE-2018-15389</a> </li>
10+
</ul>
611
<h2>How to fix it</h2>
712
<p>Credentials should be stored in a configuration file that is not committed to the code repository, in a database, or managed by your cloud
813
provider’s secrets management service. If a password is exposed in the source code, it must be changed immediately.</p>
914
<h3>Code Examples</h3>
10-
<h4>Noncompliant Code Example</h4>
15+
<h4>Noncompliant code example</h4>
1116
<pre data-diff-id="1" data-diff-type="noncompliant">
1217
$password = "65DBGgwe4uazdWQA"; // Noncompliant
1318

1419
$httpUrl = "https://example.domain?user=user&amp;password=65DBGgwe4uazdWQA" // Noncompliant
1520
$sshUrl = "ssh://user:65DBGgwe4uazdWQA@example.domain" // Noncompliant
1621
</pre>
17-
<h4>Compliant Solution</h4>
22+
<h4>Compliant solution</h4>
1823
<pre data-diff-id="1" data-diff-type="compliant">
1924
$user = getUser();
2025
$password = getPassword(); // Compliant

php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S2068.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"func": "Constant\/Issue",
1313
"constantCost": "30min"
1414
},
15+
"quickfix": "infeasible",
1516
"tags": [
1617
"cwe"
1718
],
@@ -41,6 +42,5 @@
4142
"3.5.2",
4243
"6.4.1"
4344
]
44-
},
45-
"quickfix": "unknown"
45+
}
4646
}

php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S6418.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ <h4>Noncompliant Code Example</h4>
1313
$secret = '47828a8dd77ee1eb9dde2d5e93cb221ce8c32b37'; // Noncompliant
1414
MyClass-&gt;callMyService($secret);
1515
</pre>
16-
<h4>Compliant Solution</h4>
17-
<p>Using <a href="https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/php/example_code/secretsmanager">AWS Secrets Manager</a>:</p>
16+
<h4>Compliant solution</h4>
17+
<p>Store the secret in an environment variable or configuration file:</p>
1818
<pre data-diff-id="1" data-diff-type="compliant">
19+
$secret = getenv('MY_SECRET');
20+
MyClass-&gt;callMyService($secret);
21+
</pre>
22+
<p>Or using <a href="https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/php/example_code/secretsmanager">AWS Secrets Manager</a>:</p>
23+
<pre>
1924
use Aws\SecretsManager\SecretsManagerClient;
2025
use Aws\Exception\AwsException;
2126
$client = new SecretsManagerClient(...);
@@ -45,5 +50,6 @@ <h2>Resources</h2>
4550
<li> OWASP - <a href="https://owasp.org/www-project-top-ten/2017/A2_2017-Broken_Authentication">Top 10 2017 Category A2 - Broken Authentication</a>
4651
</li>
4752
<li> CWE - <a href="https://cwe.mitre.org/data/definitions/798">CWE-798 - Use of Hard-coded Credentials</a> </li>
53+
<li> MSC - <a href="https://wiki.sei.cmu.edu/confluence/x/OjdGBQ">MSC03-J - Never hard code sensitive information</a> </li>
4854
</ul>
4955

php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S6418.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"func": "Constant\/Issue",
1313
"constantCost": "30min"
1414
},
15+
"quickfix": "infeasible",
1516
"tags": [
1617
"cwe"
1718
],
@@ -40,6 +41,5 @@
4041
"3.5.2",
4142
"6.4.1"
4243
]
43-
},
44-
"quickfix": "unknown"
44+
}
4545
}

sonarpedia.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"languages": [
44
"PHP"
55
],
6-
"latest-update": "2026-01-08T10:11:00.424605796Z",
6+
"latest-update": "2026-02-02T05:36:28.563406648Z",
77
"options": {
88
"no-language-in-filenames": true,
99
"preserve-filenames": true

0 commit comments

Comments
 (0)