mirror of
https://github.com/hohn/codeql-intro-csharp.git
synced 2025-12-15 18:23:04 +01:00
61 lines
1.6 KiB
Bash
61 lines
1.6 KiB
Bash
# -*- sh -*-
|
|
.runs | .[] | .results | .[] |
|
|
( (.ruleId, ": ",
|
|
(.message.text | split("\n") | ( .[0], " [", length-1 , " more]")),
|
|
"\n")
|
|
,
|
|
(if (.codeFlows != null) then
|
|
(.codeFlows | .[] |
|
|
(" Path\n"
|
|
,
|
|
( .threadFlows | .[] | .locations | .[] | .location | " "
|
|
,
|
|
( .physicalLocation | ( .artifactLocation.uri, ":", .region.startLine, ":"))
|
|
,
|
|
(.message.text, " ")
|
|
,
|
|
"\n"
|
|
)))
|
|
else
|
|
(.locations | .[] |
|
|
( " "
|
|
,
|
|
(.physicalLocation | ( .artifactLocation.uri, ":", .region.startLine, ":"))
|
|
))
|
|
,
|
|
# .message.text,
|
|
"\n"
|
|
end)
|
|
) | tostring
|
|
|
|
# This script extracts the following parts of the sarif output:
|
|
#
|
|
# # problem
|
|
# "runs" : [ {
|
|
# "results" : [ {
|
|
# "ruleId" : "cpp/UncheckedErrorCode",
|
|
|
|
# # path problem
|
|
# "runs" : [ {
|
|
# "tool" : {
|
|
# "driver" : {
|
|
# "rules" : [ {
|
|
# "properties" : {
|
|
# "kind" : "path-problem",
|
|
|
|
# "runs" : [ {
|
|
# "results" : [ {
|
|
# "ruleId" : "cpp/DangerousArithmetic",
|
|
# "ruleIndex" : 6,
|
|
# "message" : {
|
|
# "text" : "Potential overflow (conversion: int -> unsigned int)\nPotential overflow (con
|
|
|
|
# "runs" : [ {
|
|
# "results" : [ {
|
|
# "codeFlows" : [ {
|
|
# "threadFlows" : [ {
|
|
# "locations" : [ {
|
|
# "location" : {
|
|
# "message" : {
|
|
# "text" : "buff"
|