Sarif json is not escaping \n
on results.message.text
#5566
Labels
scan/license
Issues relating to license scanning
scan/misconfiguration
Issues relating to misconfiguration scanning
scan/secret
Issues relating to secret scanning
scan/vulnerability
Issues relating to vulnerability scanning
Discussed in #5559
Originally posted by pragmaticivan November 13, 2023
Description
Sarif format is not correctly escaping. It's using
\n
instead of\\n
. This is breaking decoders such asjson.NewDecoder(reader).Decode(sarifStruct)
.Desired Behavior
It should be escaping with
\\n
instead.Actual Behavior
Adds
\n
in the json string value.Reproduction Steps
1. generate a sarif file with example above. 2. Decode with json decoder (go) 3. Error: `parse error: invalid character '\n' in string literal` ...
Target
Filesystem
Scanner
Misconfiguration
Output Format
SARIF
Mode
Standalone
Debug Output
There's no error on trivy side, only when parsing the SARIF json.
Operating System
Github Action (Ubuntu)
Version
Checklist
trivy image --reset
The text was updated successfully, but these errors were encountered: