Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
update rules description (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-guarino-sonarsource authored and vilchik-elena committed Sep 10, 2018
1 parent 74944a5 commit d637ec2
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 19 deletions.
2 changes: 1 addition & 1 deletion sonarpedia.json
Expand Up @@ -3,7 +3,7 @@
"languages": [
"TS"
],
"latest-update": "2018-06-14T14:24:36.517Z",
"latest-update": "2018-09-10T12:57:26.086Z",
"options": {
"no-language-in-filenames": true
}
Expand Down
Expand Up @@ -13,4 +13,12 @@ <h2>Compliant Solution</h2>
...
}
</pre>
<h2>Exceptions</h2>
<p>Parameter properties are ignored.</p>
<pre>
class A {
constructor(public p1: number, public p2: number, public p3: number, public p4: number, public p5: number) {
}
}
</pre>

Expand Up @@ -18,5 +18,10 @@
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-1121",
"sqKey": "AssignmentWithinCondition",
"scope": "All"
"scope": "All",
"securityStandards": {
"CWE": [
481
]
}
}
Expand Up @@ -17,5 +17,10 @@
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-1143",
"sqKey": "S1143",
"scope": "All"
"scope": "All",
"securityStandards": {
"CWE": [
584
]
}
}
Expand Up @@ -18,5 +18,13 @@
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1525",
"sqKey": "S1525",
"scope": "Main"
"scope": "Main",
"securityStandards": {
"CWE": [
489
],
"OWASP": [
"A3"
]
}
}
Expand Up @@ -17,5 +17,10 @@
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-1854",
"sqKey": "S1854",
"scope": "All"
"scope": "All",
"securityStandards": {
"CWE": [
563
]
}
}
Expand Up @@ -17,5 +17,10 @@
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1874",
"sqKey": "S1874",
"scope": "Main"
"scope": "Main",
"securityStandards": {
"CWE": [
477
]
}
}
Expand Up @@ -22,9 +22,9 @@ <h2>See</h2>
<ul>
<li> <a href="http://cwe.mitre.org/data/definitions/798">MITRE, CWE-798</a> - Use of Hard-coded Credentials </li>
<li> <a href="http://cwe.mitre.org/data/definitions/259">MITRE, CWE-259</a> - Use of Hard-coded Password </li>
<li> <a href="http://www.sans.org/top25-software-errors/">SANS Top 25</a> - Porous Defenses </li>
<li> <a href="https://www.securecoding.cert.org/confluence/x/qQCHAQ">CERT, MSC03-J.</a> - Never hard code sensitive information </li>
<li> OWASP Top 10 2017 Category A2 - Broken Authentication </li>
<li> <a href="https://www.sans.org/top25-software-errors/#cat3">SANS Top 25</a> - Porous Defenses </li>
<li> Derived from FindSecBugs rule <a href="http://h3xstream.github.io/find-sec-bugs/bugs.htm#HARD_CODE_PASSWORD">Hard Coded Password</a> </li>
</ul>

Expand Up @@ -20,5 +20,14 @@
"defaultSeverity": "Blocker",
"ruleSpecification": "RSPEC-2068",
"sqKey": "S2068",
"scope": "Main"
"scope": "Main",
"securityStandards": {
"CWE": [
798,
259
],
"OWASP": [
"A2"
]
}
}
Expand Up @@ -18,5 +18,11 @@
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-2589",
"sqKey": "S2589",
"scope": "All"
"scope": "All",
"securityStandards": {
"CWE": [
489,
571
]
}
}
Expand Up @@ -16,5 +16,10 @@
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-2681",
"sqKey": "S2681",
"scope": "All"
"scope": "All",
"securityStandards": {
"CWE": [
483
]
}
}
Expand Up @@ -4,14 +4,18 @@
<p>This rule raises an issue when <code>+</code> is used with a string and a non-string.</p>
<h2>Noncompliant Code Example</h2>
<pre>
var x = 5 + 8; // okay
var z = "8"
var y = 5 + z; // Noncompliant; yields string "58"
function foo() {
let x = 5 + 8; // okay
let z = "8"
return x + z; // Noncompliant; yields string "138"
}
</pre>
<h2>Compliant Solution</h2>
<pre>
var x = 5 + 8;
var z = "8";
var y = 5 + Number(z);
function foo() {
let x = 5 + 8;
let z = "8"
return x + Number(z);
}
</pre>

@@ -1,6 +1,6 @@
<p>When a method is designed to return an invariant value, it may be poor design, but it shouldn't adversely affect the outcome of your program.
<p>When a function is designed to return an invariant value, it may be poor design, but it shouldn't adversely affect the outcome of your program.
However, when it happens on all paths through the logic, it is surely a bug.</p>
<p>This rule raises an issue when a method contains several <code>return</code> statements that all return the same value.</p>
<p>This rule raises an issue when a function contains several return statements that all return the same value.</p>
<h2>Noncompliant Code Example</h2>
<pre>
function foo(a: number) { // Noncompliant
Expand Down
Expand Up @@ -17,5 +17,10 @@
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-905",
"sqKey": "S905",
"scope": "Main"
"scope": "Main",
"securityStandards": {
"CWE": [
482
]
}
}

0 comments on commit d637ec2

Please sign in to comment.