diff --git a/internal/event/hclog_formatter_node.go b/internal/event/hclog_formatter_node.go index 27affbb30a..54b5f7012e 100644 --- a/internal/event/hclog_formatter_node.go +++ b/internal/event/hclog_formatter_node.go @@ -35,7 +35,8 @@ type hclogFormatterFilter struct { allow []*filter deny []*filter signer signer - l sync.RWMutex + // l protects the signer field + l sync.RWMutex } func newHclogFormatterFilter(jsonFormat bool, opt ...Option) (*hclogFormatterFilter, error) { @@ -205,6 +206,8 @@ func (f *hclogFormatterFilter) Process(ctx context.Context, e *eventlogger.Event if err != nil { return nil, fmt.Errorf("%s: unable to format: %w", op, err) } + f.l.Lock() + defer f.l.Unlock() if f.signer != nil && string(e.Type) == string(AuditType) { bufHmac, err := f.signer(ctx, buf.Bytes()) if err != nil {