sonar-gitlab-plugin icon indicating copy to clipboard operation
sonar-gitlab-plugin copied to clipboard

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

Open dzamlo opened this issue 6 years ago • 4 comments

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.

dzamlo avatar Oct 02 '18 07:10 dzamlo

Hi, Have you example for json file ? Thanks

gabrie-allaigre avatar Oct 02 '18 07:10 gabrie-allaigre

gl-code-quality-report.json.txt

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

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

dzamlo avatar Oct 02 '18 11:10 dzamlo

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

gabrie-allaigre avatar Oct 02 '18 12:10 gabrie-allaigre

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.

dzamlo avatar Oct 06 '18 19:10 dzamlo