Fix CrowdSec review findings: observe metadata, idempotent Start, HasRestrictions, proto map alias

This commit is contained in:
Viktor Liu
2026-03-29 08:50:34 +02:00
parent ae84272a30
commit 6411136fec
6 changed files with 25 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package accesslogs
import (
"maps"
"net"
"net/netip"
"time"
@@ -57,7 +58,7 @@ func (a *AccessLogEntry) FromProto(serviceLog *proto.AccessLog) {
a.BytesDownload = serviceLog.GetBytesDownload()
a.Protocol = AccessLogProtocol(serviceLog.GetProtocol())
if m := serviceLog.GetMetadata(); len(m) > 0 {
a.Metadata = m
a.Metadata = maps.Clone(m)
}
if sourceIP := serviceLog.GetSourceIp(); sourceIP != "" {