github.com/anchore/syft@v1.38.2/cmd/syft/internal/options/pkg.go (about)

     1  package options
     2  
     3  import (
     4  	"github.com/anchore/clio"
     5  	"github.com/anchore/syft/syft/cataloging"
     6  )
     7  
     8  type packageConfig struct {
     9  	SearchUnindexedArchives         bool `yaml:"search-unindexed-archives" json:"search-unindexed-archives" mapstructure:"search-unindexed-archives"`
    10  	SearchIndexedArchives           bool `yaml:"search-indexed-archives" json:"search-indexed-archives" mapstructure:"search-indexed-archives"`
    11  	ExcludeBinaryOverlapByOwnership bool `yaml:"exclude-binary-overlap-by-ownership" json:"exclude-binary-overlap-by-ownership" mapstructure:"exclude-binary-overlap-by-ownership"` // exclude synthetic binary packages owned by os package files
    12  }
    13  
    14  var _ interface {
    15  	clio.FieldDescriber
    16  } = (*packageConfig)(nil)
    17  
    18  func (o *packageConfig) DescribeFields(descriptions clio.FieldDescriptionSet) {
    19  	descriptions.Add(&o.SearchIndexedArchives, `search within archives that do contain a file index to search against (zip)
    20  note: for now this only applies to the java package cataloger`)
    21  	descriptions.Add(&o.SearchUnindexedArchives, `search within archives that do not contain a file index to search against (tar, tar.gz, tar.bz2, etc)
    22  note: enabling this may result in a performance impact since all discovered compressed tars will be decompressed
    23  note: for now this only applies to the java package cataloger`)
    24  	descriptions.Add(&o.ExcludeBinaryOverlapByOwnership, `allows users to exclude synthetic binary packages from the sbom
    25  these packages are removed if an overlap with a non-synthetic package is found`)
    26  }
    27  
    28  func defaultPackageConfig() packageConfig {
    29  	c := cataloging.DefaultArchiveSearchConfig()
    30  	return packageConfig{
    31  		SearchIndexedArchives:           c.IncludeIndexedArchives,
    32  		SearchUnindexedArchives:         c.IncludeUnindexedArchives,
    33  		ExcludeBinaryOverlapByOwnership: true,
    34  	}
    35  }