github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/cataloging/relationships.go (about) 1 package cataloging 2 3 type RelationshipsConfig struct { 4 // PackageFileOwnership will include package-to-file relationships that indicate which files are owned by which packages. 5 PackageFileOwnership bool `yaml:"package-file-ownership" json:"package-file-ownership" mapstructure:"package-file-ownership"` 6 7 // PackageFileOwnershipOverlap will include package-to-package relationships that indicate one package is owned by another due to files claimed to be owned by one package are also evidence of another package's existence. 8 // For example, if an RPM package is installed and claims to own /etc/app/package.lock and a separate NPM package was discovered by cataloging /etc/app/package.lock, then the two packages will 9 // have ownership overlap relationship. 10 PackageFileOwnershipOverlap bool `yaml:"package-file-ownership-overlap" json:"package-file-ownership-overlap" mapstructure:"package-file-ownership-overlap"` 11 12 // ExcludeBinaryPackagesWithFileOwnershipOverlap will exclude binary packages from the package catalog that are evident by files also owned by another package. 13 // For example, if a binary package representing the /bin/python binary is discovered and there is a python RPM package installed which claims to 14 // orn /bin/python, then the binary package will be excluded from the catalog altogether if this configuration is set to true. 15 ExcludeBinaryPackagesWithFileOwnershipOverlap bool `yaml:"exclude-binary-packages-with-file-ownership-overlap" json:"exclude-binary-packages-with-file-ownership-overlap" mapstructure:"exclude-binary-packages-with-file-ownership-overlap"` 16 } 17 18 func DefaultRelationshipsConfig() RelationshipsConfig { 19 return RelationshipsConfig{ 20 PackageFileOwnership: true, 21 PackageFileOwnershipOverlap: true, 22 ExcludeBinaryPackagesWithFileOwnershipOverlap: true, 23 } 24 } 25 26 func (c RelationshipsConfig) WithPackageFileOwnership(ownership bool) RelationshipsConfig { 27 c.PackageFileOwnership = ownership 28 return c 29 } 30 31 func (c RelationshipsConfig) WithPackageFileOwnershipOverlap(overlap bool) RelationshipsConfig { 32 c.PackageFileOwnershipOverlap = overlap 33 return c 34 } 35 36 func (c RelationshipsConfig) WithExcludeBinaryPackagesWithFileOwnershipOverlap(exclude bool) RelationshipsConfig { 37 c.ExcludeBinaryPackagesWithFileOwnershipOverlap = exclude 38 return c 39 }