Skip to content

Commit 5462430

Browse files
committed
fixes nil pointer: #966
1 parent 474e25e commit 5462430

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

.vscode/launch.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
"mode": "auto",
2222
"program": "${workspaceRoot}/cmd/devguard-scanner/main.go",
2323
"args": [
24-
"sca",
25-
"--path=../devguard-test",
26-
"--assetName=l3montree/projects/devguard/assets/devguard-api",
24+
"secret-scanning",
25+
"--assetName=wetteronline/projects/devguard/assets/sbom4",
2726
"--apiUrl=http://localhost:8080",
28-
"--token=5ea4f27ae4385fdcc67628a5d2360880de1b70c768bd6715568edf63c5692981"
27+
"--token=c5077f7d008d9980814d0345fdfaddcd02774d4577ed87c5b7e8cc3108447a1b"
2928
],
3029
},
3130
{

cmd/devguard-scanner/commands/sarif.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ func obfuscateSecretAndAddFingerprint(sarifScan *common.SarifResult) {
243243
// obfuscate the snippet
244244
for ru, run := range sarifScan.Runs {
245245
for re, result := range run.Results {
246+
if len(result.Locations) == 0 {
247+
continue
248+
}
249+
// make sure to set the result.Fingerprints
250+
if result.Fingerprints == nil {
251+
result.Fingerprints = &common.Fingerprints{}
252+
}
246253
// obfuscate the snippet
247254
for lo, location := range result.Locations {
248255
snippet := location.PhysicalLocation.Region.Snippet.Text

0 commit comments

Comments
 (0)