github.com/anchore/syft@v1.38.2/syft/pkg/cataloger/dotnet/config.go (about)

     1  package dotnet
     2  
     3  type CatalogerConfig struct {
     4  	// DepPackagesMustHaveDLL allows for deps.json packages to be included only if there is a DLL on disk for that package.
     5  	// app-config: dotnet.dep-packages-must-have-dll
     6  	DepPackagesMustHaveDLL bool `mapstructure:"dep-packages-must-have-dll" json:"dep-packages-must-have-dll" yaml:"dep-packages-must-have-dll"`
     7  
     8  	// DepPackagesMustClaimDLL allows for deps.json packages to be included only if there is a runtime/resource DLL claimed in the deps.json targets section.
     9  	// This does not require such claimed DLLs to exist on disk. The behavior of this
    10  	// app-config: dotnet.dep-packages-must-claim-dll
    11  	DepPackagesMustClaimDLL bool `mapstructure:"dep-packages-must-claim-dll" json:"dep-packages-must-claim-dll" yaml:"dep-packages-must-claim-dll"`
    12  
    13  	// PropagateDLLClaimsToParents allows for deps.json packages to be included if any child (transitive) package claims a DLL. This applies to both the claims configuration and evidence-on-disk configurations.
    14  	// app-config: dotnet.propagate-dll-claims-to-parents
    15  	PropagateDLLClaimsToParents bool `mapstructure:"propagate-dll-claims-to-parents" json:"propagate-dll-claims-to-parents" yaml:"propagate-dll-claims-to-parents"`
    16  
    17  	// RelaxDLLClaimsWhenBundlingDetected will look for indications of IL bundle tooling via deps.json package names
    18  	// and, if found (and this config option is enabled), will relax the DepPackagesMustClaimDLL value to `false` only in those cases.
    19  	// app-config: dotnet.relax-dll-claims-when-bundling-detected
    20  	RelaxDLLClaimsWhenBundlingDetected bool `mapstructure:"relax-dll-claims-when-bundling-detected" json:"relax-dll-claims-when-bundling-detected" yaml:"relax-dll-claims-when-bundling-detected"`
    21  }
    22  
    23  func (c CatalogerConfig) WithDepPackagesMustHaveDLL(requireDlls bool) CatalogerConfig {
    24  	c.DepPackagesMustHaveDLL = requireDlls
    25  	return c
    26  }
    27  
    28  func (c CatalogerConfig) WithDepPackagesMustClaimDLL(requireDlls bool) CatalogerConfig {
    29  	c.DepPackagesMustClaimDLL = requireDlls
    30  	return c
    31  }
    32  
    33  func (c CatalogerConfig) WithRelaxDLLClaimsWhenBundlingDetected(relax bool) CatalogerConfig {
    34  	c.RelaxDLLClaimsWhenBundlingDetected = relax
    35  	return c
    36  }
    37  
    38  func (c CatalogerConfig) WithPropagateDLLClaimsToParents(propagate bool) CatalogerConfig {
    39  	c.PropagateDLLClaimsToParents = propagate
    40  	return c
    41  }
    42  
    43  func DefaultCatalogerConfig() CatalogerConfig {
    44  	return CatalogerConfig{
    45  		DepPackagesMustHaveDLL:             false,
    46  		DepPackagesMustClaimDLL:            true,
    47  		PropagateDLLClaimsToParents:        true,
    48  		RelaxDLLClaimsWhenBundlingDetected: true,
    49  	}
    50  }