Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more rust data #2948

Open
wants to merge 66 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
38229f5
Add more rust data
C0D3-M4513R Jun 10, 2024
238913e
Better error formatting
C0D3-M4513R Jun 11, 2024
1165263
Remove leftover log statement
C0D3-M4513R Jun 11, 2024
7d54133
Add support for sparse registries
C0D3-M4513R Jun 11, 2024
3e33feb
Allow querying rust repository index for dependency info
C0D3-M4513R Jun 11, 2024
28f2d7e
Add Rust checksum verification
C0D3-M4513R Jun 11, 2024
6e87396
Fix wrong return value in DownloadLocation
C0D3-M4513R Jun 11, 2024
0f8f724
Move some of the implementation into seperate files
C0D3-M4513R Jun 11, 2024
a6569b5
Add handling of "local-registry"
C0D3-M4513R Jun 11, 2024
a9868d2
Add extra check for an empty Source field
C0D3-M4513R Jun 11, 2024
e1bd0a3
Refactor to use `:=` and saving some explicit typing
C0D3-M4513R Jun 11, 2024
895d6cc
Move RustCargoLockEntry to rust package
C0D3-M4513R Jun 11, 2024
9ffba8b
Rename RustCargoLockEntry to CargoLockEntry
C0D3-M4513R Jun 11, 2024
cca0778
Add support for getting License information
C0D3-M4513R Jun 11, 2024
3933349
fix inproper sha being produced
C0D3-M4513R Jun 11, 2024
f7e3303
Add a rust relationship graph
C0D3-M4513R Jun 11, 2024
79d11a5
Download Dependencies only once and add Licenses
C0D3-M4513R Jun 11, 2024
02ae76e
Bump go-toml to v2, to fix some parsing issues
C0D3-M4513R Jun 11, 2024
ebc99e0
Fix tests compile
C0D3-M4513R Jun 11, 2024
abccc44
Rename PackageId to PackageID (gocrytic error)
C0D3-M4513R Jun 11, 2024
50aa7ae
Ensure there is at least one Space after comment start (gocrytic error)
C0D3-M4513R Jun 11, 2024
a3e99e1
Rename local sourceId to sourceID (revive error)
C0D3-M4513R Jun 11, 2024
ff74c12
Fix superfluous-else annotation (revive error)
C0D3-M4513R Jun 11, 2024
2efe219
Unexport a bunch of stuff
C0D3-M4513R Jun 11, 2024
58728dd
Rename CargoLockEntry back to RustCargoLockEntry
C0D3-M4513R Jun 11, 2024
0a52a48
Unexport rust.PackageID
C0D3-M4513R Jun 11, 2024
55b0d48
Unexport rust.dependencyInformation and rust.dependencyDependencyInfo…
C0D3-M4513R Jun 11, 2024
f995e3a
Unexport rust.CargoToml and rust.tomlPackage
C0D3-M4513R Jun 11, 2024
4b2883c
Unexport rust.SourceId and rust.GetSourceId
C0D3-M4513R Jun 11, 2024
37447e2
Separate rust registry stuff into own package from cataloger
C0D3-M4513R Jun 11, 2024
949c0b7
Make packagemetadata tests pass
C0D3-M4513R Jun 11, 2024
c4ee380
Make Test_OriginatorSupplier pass
C0D3-M4513R Jun 11, 2024
4971937
Add additional information to parse_cargo_lock_test and test more paths
C0D3-M4513R Jun 11, 2024
f8b9c77
Fix static analysis
C0D3-M4513R Jun 11, 2024
6b34863
Remove some map assignments in `GetGeneratedInformation`
C0D3-M4513R Jun 11, 2024
d112d1c
More lint fixes
C0D3-M4513R Jun 11, 2024
b2bbcdb
Add Rust Package Descriptions
C0D3-M4513R Jun 12, 2024
260fa31
Add Rust Package Homepage
C0D3-M4513R Jun 12, 2024
b815a2a
Rust when no Homepage is available fallback to Repository
C0D3-M4513R Jun 12, 2024
2639040
Remove PathSha1Hashes from rust.GeneratedDepInfo
C0D3-M4513R Jun 12, 2024
6f033a9
Fix external_references_test.go
C0D3-M4513R Jun 12, 2024
09bc95c
Attempt to add a PackageVerificationCode to rust
C0D3-M4513R Jun 12, 2024
4d3839a
Fix Lints again
C0D3-M4513R Jun 13, 2024
5052ea4
Merge branch 'refs/heads/main' into rust-dep-info
C0D3-M4513R Jun 13, 2024
043c8ec
Add all the contains relations.
C0D3-M4513R Jun 13, 2024
faf5b7d
Bump Cli timeout
C0D3-M4513R Jun 13, 2024
91d177d
Revert bump of go-toml for python
C0D3-M4513R Jun 14, 2024
6ecc6ad
Merge remote-tracking branch 'refs/remotes/upstream/main' into rust-d…
C0D3-M4513R Jun 14, 2024
5e30e21
Add Rust Config, Use Caching
C0D3-M4513R Jun 20, 2024
ea996bc
Improve test relationship sorting
C0D3-M4513R Jun 20, 2024
daf00e3
ID's were not being set
C0D3-M4513R Jun 20, 2024
c50e815
Some renaming
C0D3-M4513R Jun 20, 2024
4a5eb07
"Fix" `packagemeta.TestAllNames`
C0D3-M4513R Jun 20, 2024
d700f57
Fix rust cargo lock test
C0D3-M4513R Jun 20, 2024
9a83f3f
Fix some lints
C0D3-M4513R Jun 20, 2024
9b73e1d
Run `goimports -w .`
C0D3-M4513R Jun 20, 2024
bb53f52
Fix typo in relationship.go
C0D3-M4513R Jun 20, 2024
3659eec
Solve Sorting being recursively applied
C0D3-M4513R Jun 21, 2024
f05da3c
Fix TestParseCargoLock
C0D3-M4513R Jun 21, 2024
4b33e16
Run `goimports -w .`
C0D3-M4513R Jun 21, 2024
c5114a1
Fix lints
C0D3-M4513R Jun 21, 2024
c6e05c4
Only produce sha1 hashes for crate contents is checksum matches
C0D3-M4513R Jun 21, 2024
0987aaa
Don't produce any information generated from source on a hash mismatch
C0D3-M4513R Jun 21, 2024
f1310fd
refactor to use DI and remove import cycles
wagoodman Jul 8, 2024
b889150
Merge branch 'main' into rust-dep-info
C0D3-M4513R Jul 9, 2024
8e0f693
Merge branch 'main' into rust-dep-info
C0D3-M4513R Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ tasks:
- cmd: "test -f {{ .SNAPSHOT_BIN }} || (find {{ .SNAPSHOT_DIR }} && echo '\nno snapshot found' && false)"
silent: true

- "go test -count=1 -timeout=15m -v ./test/cli"
- "go test -count=1 -timeout=25m -v ./test/cli"
env:
SYFT_BINARY_LOCATION: "{{ .SNAPSHOT_BIN }}"

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ require (
github.com/moby/sys/mountinfo v0.7.2
github.com/olekukonko/tablewriter v0.0.5
github.com/opencontainers/go-digest v1.0.0
github.com/pelletier/go-toml v1.9.5
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/quasilyte/go-ruleguard/dsl v0.3.22
github.com/saferwall/pe v1.5.4
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d
Expand Down Expand Up @@ -91,6 +91,7 @@ require (
github.com/OneOfOne/xxhash v1.2.8
github.com/adrg/xdg v0.5.0
github.com/magiconair/properties v1.8.7
github.com/pelletier/go-toml/v2 v2.1.0
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678
)

Expand Down
14 changes: 13 additions & 1 deletion internal/cmptest/common_options.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package cmptest

import (
"slices"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"

"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/pkg"
)
Expand All @@ -24,7 +27,16 @@ func CommonOptions(licenseCmp LicenseComparer, locationCmp LocationComparer) []c
return []cmp.Option{
cmpopts.IgnoreFields(pkg.Package{}, "id"), // note: ID is not deterministic for test purposes
cmpopts.SortSlices(pkg.Less),
cmpopts.SortSlices(DefaultRelationshipComparer),
cmp.Comparer(func(x, y []artifact.Relationship) bool {
// copy here, because we shouldn't mutate the input in any way!
cpyX := make([]artifact.Relationship, len(x))
copy(cpyX, x)
cpyY := make([]artifact.Relationship, len(y))
copy(cpyY, x)
slices.SortStableFunc(cpyX, DefaultRelationshipComparer)
slices.SortStableFunc(cpyY, DefaultRelationshipComparer)
return slices.CompareFunc(cpyX, cpyY, DefaultRelationshipComparer) == 0
}),
cmp.Comparer(
func(x, y file.LocationSet) bool {
xs := x.ToSlice()
Expand Down
82 changes: 74 additions & 8 deletions internal/cmptest/relationship.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,92 @@
package cmptest

import (
"reflect"

"github.com/sanity-io/litter"

"github.com/anchore/syft/syft/artifact"
)

type RelationshipComparer func(x, y artifact.Relationship) bool

var relationshipStringer = litter.Options{
var dataStringer = litter.Options{
Compact: true,
StripPackageNames: false,
HidePrivateFields: true, // we want to ignore package IDs
HideZeroValues: true,
StrictGo: true,
//HidePrivateFields: true, // we want to ignore package IDs
HideZeroValues: true,
StrictGo: true,
//FieldExclusions: ... // these can be added for future values that need to be ignored
//FieldFilter: ...
}

func DefaultRelationshipComparer(x, y artifact.Relationship) bool {
func DefaultRelationshipComparer(x, y artifact.Relationship) int {
if x.Type < y.Type {
return -1
}
if x.Type > y.Type {
return 1
}

if i := DefaultIdentifiableComparer(x.From, y.From); i != 0 {
return i
}
if i := DefaultIdentifiableComparer(x.To, y.To); i != 0 {
return i
}

if x.Data == nil && y.Data == nil {
return 0
}
if x.Data == nil {
return -1
}
if y.Data == nil {
return 1
}

{
xData := reflect.ValueOf(x.Data).Type().Name()
yData := reflect.ValueOf(y.Data).Type().Name()
if xData < yData {
return -1
}
if xData > yData {
return 1
}
}
// we just need a stable sort, the ordering does not need to be sensible
xStr := relationshipStringer.Sdump(x)
yStr := relationshipStringer.Sdump(y)
return xStr < yStr
xStr := dataStringer.Sdump(x.Data)
yStr := dataStringer.Sdump(y.Data)
if xStr < yStr {
return -1
}
if xStr > yStr {
return 1
}
return 0
}

func DefaultIdentifiableComparer(x, y artifact.Identifiable) int {
{
xTo := reflect.ValueOf(x).Type().Name()
yTo := reflect.ValueOf(y).Type().Name()
if xTo < yTo {
return -1
}
if xTo > yTo {
return 1
}
}
{
xFrom := x.ID()
yFrom := y.ID()
if xFrom < yFrom {
return -1
}
if xFrom > yFrom {
return 1
}
}
return 0
}
33 changes: 3 additions & 30 deletions internal/relationship/sort.go
Original file line number Diff line number Diff line change
@@ -1,42 +1,15 @@
package relationship

import (
"sort"
"slices"

"github.com/anchore/syft/internal/cmptest"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/pkg"
)

// Sort takes a set of package-to-package relationships and sorts them in a stable order by name and version.
// Note: this does not consider package-to-other, other-to-package, or other-to-other relationships.
// TODO: ideally this should be replaced with a more type-agnostic sort function that resides in the artifact package.
func Sort(rels []artifact.Relationship) {
sort.SliceStable(rels, func(i, j int) bool {
return less(rels[i], rels[j])
})
}

func less(i, j artifact.Relationship) bool {
iFrom, ok1 := i.From.(pkg.Package)
iTo, ok2 := i.To.(pkg.Package)
jFrom, ok3 := j.From.(pkg.Package)
jTo, ok4 := j.To.(pkg.Package)

if !(ok1 && ok2 && ok3 && ok4) {
return false
}

if iFrom.Name != jFrom.Name {
return iFrom.Name < jFrom.Name
}
if iFrom.Version != jFrom.Version {
return iFrom.Version < jFrom.Version
}
if iTo.Name != jTo.Name {
return iTo.Name < jTo.Name
}
if iTo.Version != jTo.Version {
return iTo.Version < jTo.Version
}
return i.Type < j.Type
slices.SortStableFunc(rels, cmptest.DefaultRelationshipComparer)
}
5 changes: 4 additions & 1 deletion internal/task/package_tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ func DefaultPackageTaskFactories() PackageTaskFactories {
),
newSimplePackageTaskFactory(ruby.NewGemFileLockCataloger, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, pkgcataloging.LanguageTag, "ruby", "gem"),
newSimplePackageTaskFactory(ruby.NewGemSpecCataloger, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, pkgcataloging.LanguageTag, "ruby", "gem", "gemspec"),
newSimplePackageTaskFactory(rust.NewCargoLockCataloger, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, pkgcataloging.LanguageTag, "rust", "cargo"),
newPackageTaskFactory(
func(cfg CatalogingFactoryConfig) pkg.Cataloger {
return rust.NewCargoLockCataloger(cfg.PackagesConfig.RustCargoLock)
}, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, pkgcataloging.LanguageTag, "rust", "cargo"),
newSimplePackageTaskFactory(swift.NewCocoapodsCataloger, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, pkgcataloging.LanguageTag, "swift", "cocoapods"),
newSimplePackageTaskFactory(swift.NewSwiftPackageManagerCataloger, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, pkgcataloging.LanguageTag, "swift", "spm"),
newSimplePackageTaskFactory(swipl.NewSwiplPackCataloger, pkgcataloging.DeclaredTag, pkgcataloging.DirectoryTag, pkgcataloging.LanguageTag, "swipl", "pack"),
Expand Down
30 changes: 19 additions & 11 deletions syft/cataloging/pkgcataloging/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@ import (
"github.com/anchore/syft/syft/pkg/cataloger/javascript"
"github.com/anchore/syft/syft/pkg/cataloger/kernel"
"github.com/anchore/syft/syft/pkg/cataloger/python"
"github.com/anchore/syft/syft/pkg/cataloger/rust"
)

type Config struct {
Binary binary.ClassifierCatalogerConfig `yaml:"binary" json:"binary" mapstructure:"binary"`
Golang golang.CatalogerConfig `yaml:"golang" json:"golang" mapstructure:"golang"`
JavaArchive java.ArchiveCatalogerConfig `yaml:"java-archive" json:"java-archive" mapstructure:"java-archive"`
JavaScript javascript.CatalogerConfig `yaml:"javascript" json:"javascript" mapstructure:"javascript"`
LinuxKernel kernel.LinuxKernelCatalogerConfig `yaml:"linux-kernel" json:"linux-kernel" mapstructure:"linux-kernel"`
Python python.CatalogerConfig `yaml:"python" json:"python" mapstructure:"python"`
Binary binary.ClassifierCatalogerConfig `yaml:"binary" json:"binary" mapstructure:"binary"`
Golang golang.CatalogerConfig `yaml:"golang" json:"golang" mapstructure:"golang"`
RustCargoLock rust.CargoLockCatalogerConfig `yaml:"cargo" json:"cargo" mapstructure:"cargo"`
JavaArchive java.ArchiveCatalogerConfig `yaml:"java-archive" json:"java-archive" mapstructure:"java-archive"`
JavaScript javascript.CatalogerConfig `yaml:"javascript" json:"javascript" mapstructure:"javascript"`
LinuxKernel kernel.LinuxKernelCatalogerConfig `yaml:"linux-kernel" json:"linux-kernel" mapstructure:"linux-kernel"`
Python python.CatalogerConfig `yaml:"python" json:"python" mapstructure:"python"`
}

func DefaultConfig() Config {
return Config{
Binary: binary.DefaultClassifierCatalogerConfig(),
Golang: golang.DefaultCatalogerConfig(),
LinuxKernel: kernel.DefaultLinuxKernelCatalogerConfig(),
Python: python.DefaultCatalogerConfig(),
JavaArchive: java.DefaultArchiveCatalogerConfig(),
Binary: binary.DefaultClassifierCatalogerConfig(),
Golang: golang.DefaultCatalogerConfig(),
RustCargoLock: rust.DefaultCargoLockCatalogerConfig(),
LinuxKernel: kernel.DefaultLinuxKernelCatalogerConfig(),
Python: python.DefaultCatalogerConfig(),
JavaArchive: java.DefaultArchiveCatalogerConfig(),
}
}

Expand Down Expand Up @@ -57,3 +60,8 @@ func (c Config) WithJavaArchiveConfig(cfg java.ArchiveCatalogerConfig) Config {
c.JavaArchive = cfg
return c
}

func (c Config) WithRustCargoLockConfig(cfg rust.CargoLockCatalogerConfig) Config {
c.RustCargoLock = cfg
return c
}
8 changes: 8 additions & 0 deletions syft/format/common/spdxhelpers/to_format_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,14 @@ func newPackageVerificationCode(rels *relationship.Index, p pkg.Package, sbom sb
digests = append(digests, d)
}

for _, r := range sbom.RelationshipsForPackage(p, artifact.ContainsRelationship) {
if digest, exists := r.Data.(file.Digest); exists {
if digest.Algorithm == "sha1" {
digests = append(digests, digest)
}
}
}

if len(digests) == 0 {
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"github.com/stretchr/testify/assert"

"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo"

Check failure on line 10 in syft/format/internal/cyclonedxutil/helpers/external_references_test.go

View workflow job for this annotation

GitHub Actions / Benchmark tests

use of internal package github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo not allowed

Check failure on line 10 in syft/format/internal/cyclonedxutil/helpers/external_references_test.go

View workflow job for this annotation

GitHub Actions / Benchmark tests

use of internal package github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo not allowed

Check failure on line 10 in syft/format/internal/cyclonedxutil/helpers/external_references_test.go

View workflow job for this annotation

GitHub Actions / Unit tests

use of internal package github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo not allowed
)

func Test_encodeExternalReferences(t *testing.T) {
Expand Down Expand Up @@ -62,7 +63,7 @@
Language: pkg.Rust,
Type: pkg.RustPkg,
Licenses: pkg.NewLicenseSet(),
Metadata: pkg.RustCargoLockEntry{
Metadata: cargo.RustCargoLockEntry{
Name: "ansi_term",
Version: "0.12.1",
Source: "registry+https://github.com/rust-lang/crates.io-index",
Expand Down
8 changes: 7 additions & 1 deletion syft/format/internal/spdxutil/helpers/description.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package helpers

import "github.com/anchore/syft/syft/pkg"
import (
"github.com/anchore/syft/syft/pkg"
)

func Description(p pkg.Package) string {
if hasMetadata(p) {
Expand All @@ -9,6 +11,10 @@ func Description(p pkg.Package) string {
return metadata.Description
case pkg.NpmPackage:
return metadata.Description
case pkg.RustCargo:
if cargoEntry := metadata.CargoEntry; cargoEntry != nil {
return cargoEntry.Description
}
}
}
return ""
Expand Down
12 changes: 11 additions & 1 deletion syft/format/internal/spdxutil/helpers/download_location.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package helpers

import "github.com/anchore/syft/syft/pkg"
import (
"github.com/anchore/syft/syft/pkg"
)

const NONE = "NONE"
const NOASSERTION = "NOASSERTION"
Expand All @@ -22,6 +24,14 @@ func DownloadLocation(p pkg.Package) string {
return NoneIfEmpty(metadata.URL)
case pkg.NpmPackageLockEntry:
return NoneIfEmpty(metadata.Resolved)
case pkg.RustCargo:
if lockEntry := metadata.LockEntry; lockEntry != nil {
url, isRemote := lockEntry.SourceRemoteURL()
if isRemote {
return NoneIfEmpty(url)
}
return NOASSERTION
}
case pkg.PhpComposerLockEntry:
return NoneIfEmpty(metadata.Dist.URL)
case pkg.PhpComposerInstalledEntry:
Expand Down
11 changes: 10 additions & 1 deletion syft/format/internal/spdxutil/helpers/homepage.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package helpers

import "github.com/anchore/syft/syft/pkg"
import (
"github.com/anchore/syft/syft/pkg"
)

func Homepage(p pkg.Package) string {
if hasMetadata(p) {
Expand All @@ -9,6 +11,13 @@ func Homepage(p pkg.Package) string {
return metadata.Homepage
case pkg.NpmPackage:
return metadata.Homepage
case pkg.RustCargo:
if cargoEntry := metadata.CargoEntry; cargoEntry != nil {
if cargoEntry.Homepage != "" {
return cargoEntry.Homepage
}
return cargoEntry.Repository
}
}
}
return ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

"github.com/anchore/syft/syft/internal/packagemetadata"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo"

Check failure on line 10 in syft/format/internal/spdxutil/helpers/originator_supplier_test.go

View workflow job for this annotation

GitHub Actions / Benchmark tests

use of internal package github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo not allowed

Check failure on line 10 in syft/format/internal/spdxutil/helpers/originator_supplier_test.go

View workflow job for this annotation

GitHub Actions / Benchmark tests

use of internal package github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo not allowed

Check failure on line 10 in syft/format/internal/spdxutil/helpers/originator_supplier_test.go

View workflow job for this annotation

GitHub Actions / Unit tests

use of internal package github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo not allowed
)

func Test_OriginatorSupplier(t *testing.T) {
Expand Down Expand Up @@ -38,7 +39,7 @@
pkg.PythonRequirementsEntry{},
pkg.PythonPoetryLockEntry{},
pkg.RustBinaryAuditEntry{},
pkg.RustCargoLockEntry{},
cargo.RustCargoLockEntry{},
pkg.SwiftPackageManagerResolvedEntry{},
pkg.SwiplPackEntry{},
pkg.OpamPackage{},
Expand Down
3 changes: 2 additions & 1 deletion syft/format/syftjson/model/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

"github.com/anchore/syft/syft/license"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo"

Check failure on line 13 in syft/format/syftjson/model/package_test.go

View workflow job for this annotation

GitHub Actions / Benchmark tests

use of internal package github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo not allowed

Check failure on line 13 in syft/format/syftjson/model/package_test.go

View workflow job for this annotation

GitHub Actions / Benchmark tests

use of internal package github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo not allowed

Check failure on line 13 in syft/format/syftjson/model/package_test.go

View workflow job for this annotation

GitHub Actions / Unit tests

use of internal package github.com/anchore/syft/syft/pkg/cataloger/rust/internal/cargo not allowed
)

func Test_UnmarshalJSON(t *testing.T) {
Expand Down Expand Up @@ -355,7 +356,7 @@
}`),
assert: func(p *Package) {
assert.Equal(t, pkg.HackagePkg, p.Type)
assert.Equal(t, reflect.TypeOf(pkg.RustCargoLockEntry{}).Name(), reflect.TypeOf(p.Metadata).Name())
assert.Equal(t, reflect.TypeOf(cargo.RustCargoLockEntry{}).Name(), reflect.TypeOf(p.Metadata).Name())
},
},
{
Expand Down
Loading
Loading