fix: Use separate event for trusted package allowed (#98)

This commit is contained in:
Abhisek Datta
2026-01-08 01:03:31 +05:30
committed by GitHub
parent 0603df8c25
commit 1684e25cc9
2 changed files with 40 additions and 6 deletions
+20 -6
View File
@@ -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{