@@ -16,7 +16,9 @@ func TestPurls(t *testing.T) {
16
16
})
17
17
i := NewInventory (o , nil , "" , "" )
18
18
pkg := & models.PackageInsights {
19
- Purl : "pkg:github/org/owner" ,
19
+ Purl : "pkg:github/org/owner" ,
20
+ SourceGitRepo : "org/owner" ,
21
+ SourceGitRef : "main" ,
20
22
}
21
23
_ = pkg .NormalizePurl ()
22
24
scannedPackage , err := i .ScanPackage (context .Background (), * pkg , "testdata" )
@@ -39,17 +41,16 @@ func TestPurls(t *testing.T) {
39
41
"pkg:gitlabci/include/project?file_name=%2Ftemplates%2F.gitlab-ci-template.yml&project=my-group%2Fmy-project&ref=main" ,
40
42
"pkg:gitlabci/include/remote?download_url=https%3A%2F%2Fexample.com%2F.gitlab-ci.yml" ,
41
43
"pkg:gitlabci/include/component?project=my-org%2Fsecurity-components%2Fsecret-detection&ref=1.0&repository_url=gitlab.example.com" ,
42
- // "pkg:gitlabci/include/local?file_name=%2F.local-ci-template.yml",
43
- // "pkg:gitlabci/include/local?file_name=.gitlab-ci.yml",
44
44
"pkg:githubactions/org/repo@main" ,
45
45
"pkg:docker/debian%3Avuln" ,
46
46
"pkg:githubactions/bridgecrewio/checkov-action@main" ,
47
47
"pkg:githubactions/org/repo@main#.github/workflows/Reusable.yml" ,
48
48
"pkg:azurepipelinestask/DownloadPipelineArtifact@2" ,
49
49
"pkg:azurepipelinestask/Cache@2" ,
50
+ "pkg:githubactions/org/owner@main#.github/workflows/ci.yml" ,
50
51
}
51
52
assert .ElementsMatch (t , i .Purls (* scannedPackage ), purls )
52
- assert .Equal (t , 18 , len (scannedPackage .BuildDependencies ))
53
+ assert .Equal (t , 19 , len (scannedPackage .BuildDependencies ))
53
54
assert .Equal (t , 4 , len (scannedPackage .PackageDependencies ))
54
55
}
55
56
@@ -60,7 +61,9 @@ func TestFindings(t *testing.T) {
60
61
i := NewInventory (o , nil , "gitlab" , "" )
61
62
purl := "pkg:github/org/owner"
62
63
pkg := & models.PackageInsights {
63
- Purl : purl ,
64
+ Purl : purl ,
65
+ SourceGitRepo : "org/owner" ,
66
+ SourceGitRef : "main" ,
64
67
}
65
68
_ = pkg .NormalizePurl ()
66
69
@@ -436,7 +439,9 @@ func TestSkipRule(t *testing.T) {
436
439
purl := "pkg:github/org/owner"
437
440
rule_id := "known_vulnerability_in_build_component"
438
441
pkg := & models.PackageInsights {
439
- Purl : purl ,
442
+ Purl : purl ,
443
+ SourceGitRepo : "org/owner" ,
444
+ SourceGitRef : "main" ,
440
445
}
441
446
_ = pkg .NormalizePurl ()
442
447
@@ -484,7 +489,9 @@ func TestRulesConfig(t *testing.T) {
484
489
rule_id := "pr_runs_on_self_hosted"
485
490
path := ".github/workflows/allowed_pr_runner.yml"
486
491
pkg := & models.PackageInsights {
487
- Purl : purl ,
492
+ Purl : purl ,
493
+ SourceGitRepo : "org/owner" ,
494
+ SourceGitRef : "main" ,
488
495
}
489
496
_ = pkg .NormalizePurl ()
490
497
0 commit comments