diff --git a/pkg/common/purl/purl.go b/pkg/common/purl/purl.go index 482c183..aae5788 100644 --- a/pkg/common/purl/purl.go +++ b/pkg/common/purl/purl.go @@ -55,6 +55,8 @@ func purlBuildLockfilePackageName(ecosystem lockfile.Ecosystem, group, name stri return fmt.Sprintf("%s/%s", group, name) case lockfile.MavenEcosystem: return fmt.Sprintf("%s:%s", group, name) + case models.EcosystemGitHubActions: + return fmt.Sprintf("%s/%s", group, name) default: return name } diff --git a/pkg/common/purl/purl_test.go b/pkg/common/purl/purl_test.go index 2b0076b..c65ffe3 100644 --- a/pkg/common/purl/purl_test.go +++ b/pkg/common/purl/purl_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/google/osv-scanner/pkg/lockfile" + "github.com/safedep/vet/pkg/models" "github.com/stretchr/testify/assert" ) @@ -41,6 +42,14 @@ func TestParsePackageUrl(t *testing.T) { "", errors.New("failed to map PURL type:unknown to known ecosystem"), }, + { + "Parse GitHub Actions PURL", + "pkg:actions/github/actions@v2", + lockfile.Ecosystem(models.EcosystemGitHubActions), + "github/actions", + "v2", + nil, + }, } for _, test := range cases { diff --git a/pkg/reporter/sync.go b/pkg/reporter/sync.go index 1bb577e..7f29340 100644 --- a/pkg/reporter/sync.go +++ b/pkg/reporter/sync.go @@ -344,7 +344,7 @@ func (s *syncReporter) syncEvent(event *analyzer.AnalyzerEvent) error { } logger.Debugf("Report Sync: Publishing policy violation for package: %s/%s/%s/%s", - pkg.GetSpecEcosystem(), pkg.Manifest.GetDisplayPath(), pkg.GetName(), pkg.GetVersion()) + pkg.Manifest.GetControlTowerSpecEcosystem(), pkg.Manifest.GetDisplayPath(), pkg.GetName(), pkg.GetVersion()) namespace := pkg.Manifest.GetSource().GetNamespace() req := controltowerv1.PublishPolicyViolationRequest{ @@ -398,7 +398,7 @@ func (s *syncReporter) syncPackage(pkg *models.Package) error { } logger.Debugf("Report Sync: Publishing package insight for package: %s/%s/%s/%s", - pkg.GetSpecEcosystem(), pkg.Manifest.GetDisplayPath(), pkg.GetName(), pkg.GetVersion()) + pkg.Manifest.GetControlTowerSpecEcosystem(), pkg.Manifest.GetDisplayPath(), pkg.GetName(), pkg.GetVersion()) namespace := pkg.Manifest.GetSource().GetNamespace() req := controltowerv1.PublishPackageInsightRequest{