Skip to content

Commit

Permalink
internal/sarif: compute relative paths for findings
Browse files Browse the repository at this point in the history
And also make sure the paths are not added in binary mode.

Updates golang/go#61347

Change-Id: If48fe57215cdecb01b8b687fbe042aae584f1d6d
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/558016
Reviewed-by: Maceo Thompson <maceothompson@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
  • Loading branch information
zpavlinovic committed Apr 15, 2024
1 parent 7bf0c05 commit 4b737a9
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -131,7 +134,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -148,7 +154,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "golang.org/vuln",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "vuln.go",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 14,
"startColumn": 20
Expand All @@ -163,7 +172,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 297,
"startColumn": 12
Expand All @@ -178,7 +190,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 1881,
"startColumn": 36
Expand All @@ -193,7 +208,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 220,
"startColumn": 17
Expand Down Expand Up @@ -222,7 +240,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "golang.org/vuln",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "vuln.go",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 14,
"startColumn": 20
Expand All @@ -237,7 +258,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 297,
"startColumn": 12
Expand All @@ -252,7 +276,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 1881,
"startColumn": 36
Expand All @@ -267,7 +294,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 2587,
"startColumn": 21
Expand All @@ -282,7 +312,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 2631,
"startColumn": 21
Expand All @@ -297,7 +330,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 220,
"startColumn": 17
Expand All @@ -321,7 +357,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -338,7 +377,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "golang.org/vuln",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "vuln.go",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 13,
"startColumn": 16
Expand All @@ -353,7 +395,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "golang.org/x/text",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "language/parse.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 228,
"startColumn": 6
Expand Down Expand Up @@ -382,7 +427,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "golang.org/vuln",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "vuln.go",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 13,
"startColumn": 16
Expand All @@ -397,7 +445,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "golang.org/x/text",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "language/parse.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 228,
"startColumn": 6
Expand All @@ -421,7 +472,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -438,7 +492,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "golang.org/vuln",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "vuln.go",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 14,
"startColumn": 20
Expand All @@ -453,7 +510,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 296,
"startColumn": 17
Expand Down Expand Up @@ -482,7 +542,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "golang.org/vuln",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "vuln.go",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 14,
"startColumn": 20
Expand All @@ -497,7 +560,10 @@ $ govulncheck -C ${moddir}/vuln -format sarif ./...
"module": "github.com/tidwall/gjson",
"location": {
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "gjson.go",
"uriBaseId": "%GOMODCACHE%"
},
"region": {
"startLine": 296,
"startColumn": 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ $ govulncheck -format sarif -scan module -C ${moddir}/vuln
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -131,7 +134,10 @@ $ govulncheck -format sarif -scan module -C ${moddir}/vuln
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -149,7 +155,10 @@ $ govulncheck -format sarif -scan module -C ${moddir}/vuln
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -167,7 +176,10 @@ $ govulncheck -format sarif -scan module -C ${moddir}/vuln
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ $ govulncheck -format sarif -scan package -C ${moddir}/vuln .
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -131,7 +134,10 @@ $ govulncheck -format sarif -scan package -C ${moddir}/vuln .
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -149,7 +155,10 @@ $ govulncheck -format sarif -scan package -C ${moddir}/vuln .
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand All @@ -167,7 +176,10 @@ $ govulncheck -format sarif -scan package -C ${moddir}/vuln .
"locations": [
{
"physicalLocation": {
"artifactLocation": {},
"artifactLocation": {
"uri": "go.mod",
"uriBaseId": "%SRCROOT%"
},
"region": {
"startLine": 1
}
Expand Down

0 comments on commit 4b737a9

Please sign in to comment.