diff --git a/extractor/list/list.go b/extractor/list/list.go index 4b98c12e..44e98112 100644 --- a/extractor/list/list.go +++ b/extractor/list/list.go @@ -37,6 +37,7 @@ import ( "github.com/google/osv-scalibr/extractor/os/cos" "github.com/google/osv-scalibr/extractor/os/dpkg" "github.com/google/osv-scalibr/extractor/os/rpm" + "github.com/google/osv-scalibr/extractor/os/testractor" "github.com/google/osv-scalibr/extractor/osv" "github.com/google/osv-scalibr/extractor/sbom/spdx" "github.com/google/osv-scalibr/log" @@ -69,6 +70,7 @@ var ( &apk.Extractor{}, rpm.New(rpm.DefaultConfig()), &cos.Extractor{}, + &testractor.Extractor{}, } // Collections of extractors. diff --git a/extractor/os/testractor/extractor.go b/extractor/os/testractor/extractor.go new file mode 100644 index 00000000..fdb0fbb5 --- /dev/null +++ b/extractor/os/testractor/extractor.go @@ -0,0 +1,51 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package cos extracts OS packages from Container Optimized OSes (go/cos). +package testractor + +import ( + "context" + "io/fs" + + "github.com/google/osv-scalibr/extractor" + "github.com/google/osv-scalibr/purl" +) + +// Extractor is a test extractor. +type Extractor struct{} + +// Name of the extractor. +func (e Extractor) Name() string { return "os/test" } + +// Version of the extractor. +func (e Extractor) Version() int { return 0 } + +// FileRequired returns true if the specified file matches cos package info file pattern. +func (e Extractor) FileRequired(path string, _ fs.FileMode) bool { + return false +} + +// Extract extracts packages from cos package info files passed through the scan input. +func (e Extractor) Extract(ctx context.Context, input *extractor.ScanInput) ([]*extractor.Inventory, error) { + return nil, nil +} + +// ToPURL converts an inventory created by this extractor into a PURL. +func (e Extractor) ToPURL(i *extractor.Inventory) (*purl.PackageURL, error) { + return &purl.PackageURL{}, nil +} + +// ToCPEs is not applicable as this extractor does not infer CPEs from the Inventory. +func (e Extractor) ToCPEs(i *extractor.Inventory) ([]string, error) { return []string{}, nil }