You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SARIF format allows specifying related locations to the root defect. GitHub is able to parse this location data and show them in a semi-usable way (examples below).
relatedLocations[] - A set of locations relevant to this result. Code scanning will link to related locations when they are embedded in the result message. For more information, see the location object.
Note: This feature requires the support for region data to be implemented first: #136
Example of relatedLocations used in SARIF
I'm using ShellCheck as an example, but I believe that this might be useful also for other static analyzers.
The shell script used in the example:
#!/bin/bashecho"I'm innocent script, just pass the name of the directory as parameter and I'll remove it for you..."
DIR_SUFFIX="*"
UNUSED_VAR=""echo"I'm going to remove directory $1/$DIR_SUFFIX"#! FIXME - Call rm -rf $1/$DIR_SUFFIXecho"<img src="foo.png" />"> file.html
files='file1 file2'
combined_file=`cat ${files}`echo"${combined_file}"
rm $1echo$1# Unquoted variables
find . -name *.ogg # Unquoted find/grep patterns
rm "~/my file.txt"# Quoted tilde expansion
v='--verbose="true"'; cmd $v# Literal quotes in variables
Description
SARIF format allows specifying related locations to the root
defect
. GitHub is able to parse this location data and show them in a semi-usable way (examples below).Note: This feature requires the support for
region
data to be implemented first: #136Example of
relatedLocations
used in SARIFI'm using ShellCheck as an example, but I believe that this might be useful also for other static analyzers.
The shell script used in the example:
The GitHub requires links to
relatedLocations
directly in themessage.text
string. Otherwise, it doesn't show them in UI.Data for
relatedLocations
can be gathered when using ShellCheck JSON1 format.Full ShellCheck JSON1
Full edited csgrep SARIF
GitHub UI
Upon clicking on the link with suggestions, the pop-up box shows the location (not visible enough IMHO):
The data can be used to show suggestions in console output as well. For example
sarif-fmt
tool shows:Related to:
The text was updated successfully, but these errors were encountered: