diff --git a/syft/file/mock_resolver.go b/syft/file/mock_resolver.go index 833c8517f..5f6456acd 100644 --- a/syft/file/mock_resolver.go +++ b/syft/file/mock_resolver.go @@ -14,7 +14,6 @@ import ( var _ Resolver = (*MockResolver)(nil) var _ OCIMediaTypeResolver = (*MockResolver)(nil) -var _ OCIArtifactResolver = (*MockResolver)(nil) // MockResolver implements the FileResolver interface and is intended for use *only in test code*. // It provides an implementation that can resolve local filesystem paths using only a provided discrete list of file diff --git a/syft/file/resolver.go b/syft/file/resolver.go index d2f6cc5cf..24a03e8fb 100644 --- a/syft/file/resolver.go +++ b/syft/file/resolver.go @@ -63,17 +63,6 @@ type OCIMediaTypeResolver interface { FilesByMediaType(types ...string) ([]Location, error) } -// OCIArtifactResolver exposes the user-supplied OCI image reference to -// catalogers. Catalogers can type-assert a Resolver to this interface when they -// need a naming or context hint that the layer contents alone don't carry — for -// example, when a repacked AI model artifact has stripped name fields out of its -// config.json and the only remaining identifier is the image reference itself. -type OCIArtifactResolver interface { - // ImageReference returns the image reference the artifact was fetched with, e.g. - // "docker.io/ai/smollm2-vllm:360M". Returns "" when not known. - ImageReference() string -} - // LocationResolver provides iteration over all file locations in a source. type LocationResolver interface { // AllLocations returns a channel of all file references from the underlying source. diff --git a/syft/internal/fileresolver/container_image_model.go b/syft/internal/fileresolver/container_image_model.go index 8db7abf58..a42307e32 100644 --- a/syft/internal/fileresolver/container_image_model.go +++ b/syft/internal/fileresolver/container_image_model.go @@ -12,7 +12,6 @@ import ( var _ file.Resolver = (*ContainerImageModel)(nil) var _ file.OCIMediaTypeResolver = (*ContainerImageModel)(nil) -var _ file.OCIArtifactResolver = (*ContainerImageModel)(nil) // LayerInfo holds information about an OCI model layer file stored on disk. type LayerInfo struct { diff --git a/syft/pkg/cataloger/ai/processor.go b/syft/pkg/cataloger/ai/processor.go index f5f9ca307..efd7824f9 100644 --- a/syft/pkg/cataloger/ai/processor.go +++ b/syft/pkg/cataloger/ai/processor.go @@ -18,6 +18,7 @@ import ( "github.com/anchore/syft/internal/log" "github.com/anchore/syft/syft/artifact" "github.com/anchore/syft/syft/file" + "github.com/anchore/syft/syft/internal/fileresolver" "github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg/cataloger/internal/licenses" ) @@ -417,7 +418,9 @@ func resolveSafeTensorsOCIIdentity(resolver file.Resolver, md *pkg.SafeTensorsMo } func ociImageRefBasename(resolver file.Resolver) string { - info, ok := resolver.(file.OCIArtifactResolver) + // TODO: we don't think this approach is generalizable quite yet, but we really do need this information. + // (Ideally we should be NOT be type asserting on the file resolver directly). + info, ok := resolver.(*fileresolver.ContainerImageModel) if !ok { return "" } diff --git a/syft/source/ocimodelsource/oci_model_source.go b/syft/source/ocimodelsource/oci_model_source.go index afa16bc1e..8fd5e3849 100644 --- a/syft/source/ocimodelsource/oci_model_source.go +++ b/syft/source/ocimodelsource/oci_model_source.go @@ -39,7 +39,6 @@ type ociModelSource struct { resolver interface { file.Resolver file.OCIMediaTypeResolver - file.OCIArtifactResolver } mutex *sync.Mutex }