mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
update config handling and add support for removing config
This commit is contained in:
@@ -42,6 +42,7 @@ type PackageManagerGuardConfig struct {
|
||||
AnalysisTimeout time.Duration
|
||||
DryRun bool
|
||||
InsecureInstallation bool
|
||||
TrustedPackages map[string][]string
|
||||
}
|
||||
|
||||
func DefaultPackageManagerGuardConfig() PackageManagerGuardConfig {
|
||||
@@ -51,6 +52,7 @@ func DefaultPackageManagerGuardConfig() PackageManagerGuardConfig {
|
||||
AnalysisTimeout: 5 * time.Minute,
|
||||
DryRun: false,
|
||||
InsecureInstallation: false,
|
||||
TrustedPackages: map[string][]string{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +156,14 @@ func (g *packageManagerGuard) Run(ctx context.Context, args []string, parsedComm
|
||||
}
|
||||
|
||||
if result.Action == analyzer.ActionConfirm {
|
||||
ecosystem := result.PackageVersion.Package.Ecosystem
|
||||
for k, v := range g.config.TrustedPackages {
|
||||
if k == ecosystem.String() {
|
||||
// Check for packages
|
||||
_ = v
|
||||
}
|
||||
}
|
||||
|
||||
confirmableMalwarePackages = append(confirmableMalwarePackages, result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user