Skip to content

Commit 8990ffa

Browse files
Add SonarQube report configuration for code quality analysis
1 parent 77b9175 commit 8990ffa

File tree

6 files changed

+210
-0
lines changed

6 files changed

+210
-0
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

java/example2/bin/main/log4j2.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!--
2+
Copyright 2021 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<?xml version="1.0" encoding="UTF-8"?>
18+
<!--
19+
Copyright 2021 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
20+
21+
Licensed under the Apache License, Version 2.0 (the "License");
22+
you may not use this file except in compliance with the License.
23+
You may obtain a copy of the License at
24+
25+
http://www.apache.org/licenses/LICENSE-2.0
26+
27+
Unless required by applicable law or agreed to in writing, software
28+
distributed under the License is distributed on an "AS IS" BASIS,
29+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30+
See the License for the specific language governing permissions and
31+
limitations under the License.
32+
-->
33+
34+
<Configuration>
35+
<Appenders>
36+
<Console name="Console" target="SYSTEM_OUT">
37+
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
38+
</Console>
39+
</Appenders>
40+
<Loggers>
41+
<Root level="debug">
42+
<AppenderRef ref="Console"/>
43+
</Root>
44+
</Loggers>
45+
</Configuration>

php/report-sonar.sarif

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
{
2+
"runs" : [ {
3+
"tool" : {
4+
"driver" : {
5+
"guid" : "SonarQube",
6+
"fullName" : "SonarQube",
7+
"rules" : [ {
8+
"guid" : "php:S121",
9+
"shortDescription" : {
10+
"text" : "Add curly braces around the nested statement(s)."
11+
}
12+
}, {
13+
"guid" : "php:S2077",
14+
"shortDescription" : {
15+
"text" : "Make sure that formatting this SQL query is safe here."
16+
}
17+
}, {
18+
"guid" : "php:S1781",
19+
"shortDescription" : {
20+
"text" : "Write this \"NULL\" constant in lower case."
21+
}
22+
}, {
23+
"guid" : "php:S1192",
24+
"shortDescription" : {
25+
"text" : "Define a constant instead of duplicating this literal \"put your unique phrase here\" 8 times."
26+
}
27+
} ]
28+
}
29+
},
30+
"results" : [ {
31+
"ruleId" : "php:S2077",
32+
"level" : "warning",
33+
"message" : {
34+
"text" : "Make sure that formatting this SQL query is safe here."
35+
},
36+
"locations" : [ {
37+
"physicalLocation" : {
38+
"artifactLocation" : {
39+
"uri" : "/Users/botelho/Library/CloudStorage/Dropbox/My-Code/My-Vulnerable-Code-Snippets/php/example2/basic-collection.php"
40+
},
41+
"region" : {
42+
"startLine" : 23,
43+
"startColumn" : 0,
44+
"endLine" : 23,
45+
"endColumn" : 23
46+
}
47+
}
48+
} ]
49+
}, {
50+
"ruleId" : "php:S1781",
51+
"level" : "note",
52+
"message" : {
53+
"text" : "Write this \"NULL\" constant in lower case."
54+
},
55+
"locations" : [ {
56+
"physicalLocation" : {
57+
"artifactLocation" : {
58+
"uri" : "/Users/botelho/Library/CloudStorage/Dropbox/My-Code/My-Vulnerable-Code-Snippets/php/example2/sql-injection.php"
59+
},
60+
"region" : {
61+
"startLine" : 23,
62+
"startColumn" : 4,
63+
"endLine" : 23,
64+
"endColumn" : 23
65+
}
66+
}
67+
} ]
68+
}, {
69+
"ruleId" : "php:S121",
70+
"level" : "error",
71+
"message" : {
72+
"text" : "Add curly braces around the nested statement(s)."
73+
},
74+
"locations" : [ {
75+
"physicalLocation" : {
76+
"artifactLocation" : {
77+
"uri" : "/Users/botelho/Library/CloudStorage/Dropbox/My-Code/My-Vulnerable-Code-Snippets/php/example2/sql-injection.php"
78+
},
79+
"region" : {
80+
"startLine" : 23,
81+
"startColumn" : 0,
82+
"endLine" : 23,
83+
"endColumn" : 23
84+
}
85+
}
86+
} ]
87+
}, {
88+
"ruleId" : "php:S1781",
89+
"level" : "note",
90+
"message" : {
91+
"text" : "Write this \"NULL\" constant in lower case."
92+
},
93+
"locations" : [ {
94+
"physicalLocation" : {
95+
"artifactLocation" : {
96+
"uri" : "/Users/botelho/Library/CloudStorage/Dropbox/My-Code/My-Vulnerable-Code-Snippets/php/example2/cross-site-scripting-xss.php"
97+
},
98+
"region" : {
99+
"startLine" : 21,
100+
"startColumn" : 4,
101+
"endLine" : 21,
102+
"endColumn" : 21
103+
}
104+
}
105+
} ]
106+
}, {
107+
"ruleId" : "php:S121",
108+
"level" : "error",
109+
"message" : {
110+
"text" : "Add curly braces around the nested statement(s)."
111+
},
112+
"locations" : [ {
113+
"physicalLocation" : {
114+
"artifactLocation" : {
115+
"uri" : "/Users/botelho/Library/CloudStorage/Dropbox/My-Code/My-Vulnerable-Code-Snippets/php/example2/cross-site-scripting-xss.php"
116+
},
117+
"region" : {
118+
"startLine" : 21,
119+
"startColumn" : 0,
120+
"endLine" : 21,
121+
"endColumn" : 21
122+
}
123+
}
124+
} ]
125+
}, {
126+
"ruleId" : "php:S1192",
127+
"level" : "error",
128+
"message" : {
129+
"text" : "Define a constant instead of duplicating this literal \"put your unique phrase here\" 8 times."
130+
},
131+
"locations" : [ {
132+
"physicalLocation" : {
133+
"artifactLocation" : {
134+
"uri" : "/Users/botelho/Library/CloudStorage/Dropbox/My-Code/My-Vulnerable-Code-Snippets/php/example1/wp-config.php"
135+
},
136+
"region" : {
137+
"startLine" : 63,
138+
"startColumn" : 28,
139+
"endLine" : 63,
140+
"endColumn" : 63
141+
}
142+
}
143+
} ]
144+
}, {
145+
"ruleId" : "php:S2077",
146+
"level" : "warning",
147+
"message" : {
148+
"text" : "Make sure that formatting this SQL query is safe here."
149+
},
150+
"locations" : [ {
151+
"physicalLocation" : {
152+
"artifactLocation" : {
153+
"uri" : "/Users/botelho/Library/CloudStorage/Dropbox/My-Code/My-Vulnerable-Code-Snippets/php/example2/sql-injection_2.php"
154+
},
155+
"region" : {
156+
"startLine" : 25,
157+
"startColumn" : 9,
158+
"endLine" : 25,
159+
"endColumn" : 25
160+
}
161+
}
162+
} ]
163+
} ]
164+
} ]
165+
}

0 commit comments

Comments
 (0)