gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
713 stars 207 forks source link

Newline in the issue message are not escaped when building the json #181

Open dzamlo opened 5 years ago

dzamlo commented 5 years ago

If the message of an issue contain a newline (\n) character, it isn't escaped line when the codeclimate.json file is generated. This means that the value for the "check_name" key contains an new line character. This makes the json invalid and Gitlab then fail to parse it.

gabrie-allaigre commented 5 years ago

Hi, Have you example for json file ? Thanks

dzamlo commented 5 years ago

gl-code-quality-report.json.txt

I replaced potentially sensitive information by --removed--.

The issue come from https://github.com/mwz/sonar-scala

gabrie-allaigre commented 5 years ago

Bug is here https://github.com/gabrie-allaigre/sonar-gitlab-plugin/blob/master/src/main/java/com/talanlabs/sonar/plugins/gitlab/Reporter.java#L263

dzamlo commented 5 years ago

According to https://tools.ietf.org/html/rfc4627 and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf, all character with value < 32 should be escaped, not only the new line.