mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: Use separate event for trusted package allowed (#98)
This commit is contained in:
@@ -17,12 +17,13 @@ import (
|
||||
type EventType string
|
||||
|
||||
const (
|
||||
EventTypeMalwareBlocked EventType = "malware_blocked"
|
||||
EventTypeMalwareConfirmed EventType = "malware_confirmed"
|
||||
EventTypeInstallAllowed EventType = "install_allowed"
|
||||
EventTypeInstallStarted EventType = "install_started"
|
||||
EventTypeDependencyResolved EventType = "dependency_resolved"
|
||||
EventTypeError EventType = "error"
|
||||
EventTypeMalwareBlocked EventType = "malware_blocked"
|
||||
EventTypeMalwareConfirmed EventType = "malware_confirmed"
|
||||
EventTypeInstallAllowed EventType = "install_allowed"
|
||||
EventTypeInstallTrustedAllowed EventType = "install_trusted_allowed"
|
||||
EventTypeInstallStarted EventType = "install_started"
|
||||
EventTypeDependencyResolved EventType = "dependency_resolved"
|
||||
EventTypeError EventType = "error"
|
||||
)
|
||||
|
||||
// Event represents a security event
|
||||
@@ -334,6 +335,19 @@ func LogInstallAllowed(packageName, version, ecosystem string, packageCount int)
|
||||
LogEvent(event)
|
||||
}
|
||||
|
||||
// LogInstallTrustedAllowed logs when an installation is allowed for a trusted package
|
||||
func LogInstallTrustedAllowed(packageName, version, ecosystem string) {
|
||||
event := Event{
|
||||
EventType: EventTypeInstallTrustedAllowed,
|
||||
Message: fmt.Sprintf("Installation allowed for trusted package: %s@%s", packageName, version),
|
||||
PackageName: packageName,
|
||||
Version: version,
|
||||
Ecosystem: ecosystem,
|
||||
}
|
||||
|
||||
LogEvent(event)
|
||||
}
|
||||
|
||||
// LogInstallStarted logs when an installation starts
|
||||
func LogInstallStarted(packageManager string, args []string) {
|
||||
event := Event{
|
||||
|
||||
Reference in New Issue
Block a user