From dadde9428fddbe931d2e1d71aaf7da02b1f3f631 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Mon, 2 Mar 2026 12:24:14 +0200 Subject: [PATCH] protecting write operation in decorator --- utils/utils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/utils.go b/utils/utils.go index 2e7572eb9..3376a15a1 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -11,6 +11,7 @@ import ( "os" "path/filepath" "strings" + "sync" "github.com/CycloneDX/cyclonedx-go" xscutils "github.com/jfrog/jfrog-client-go/xsc/services/utils" @@ -448,6 +449,7 @@ func isArtifactChecksumsMatch(remoteFileDetails *fileutils.FileDetails, localFil // LineDecoratorWriter is a line decorator that writes each line to the underlying writer with an optional prefix and suffix. type LineDecoratorWriter struct { + mu sync.Mutex w io.Writer prefix []byte suffix []byte @@ -465,6 +467,8 @@ func NewLineDecoratorWriter(w io.Writer, prefix, suffix string) *LineDecoratorWr } func (p *LineDecoratorWriter) Write(data []byte) (n int, err error) { + p.mu.Lock() + defer p.mu.Unlock() n = len(data) p.buf = append(p.buf, data...) for {