Skip to content

Commit 2466618

Browse files
committed
chore: sanitizeLogInput
1 parent b5c6c2e commit 2466618

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libproxy/proxy.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ func proxyHandler(response http.ResponseWriter, request *http.Request) {
475475
r, exists := request.MultipartForm.Value[multipartRequestDataKey]
476476
if !exists || len(r) == 0 {
477477
atomic.AddUint64(&totalErrors, 1)
478-
ErrorLogger.Printf("Invalid multipart form from %s: missing %s key", clientIP, multipartRequestDataKey)
478+
ErrorLogger.Printf("Invalid multipart form from %s: missing %s key", clientIP, sanitizeLogInput(multipartRequestDataKey))
479479
_, writeErr := fmt.Fprintln(response, ErrorBodyInvalidRequest)
480480
if writeErr != nil {
481481
ErrorLogger.Printf("Failed to write error response: %v", writeErr)
@@ -594,13 +594,13 @@ func proxyHandler(response http.ResponseWriter, request *http.Request) {
594594
for _, val := range request.MultipartForm.File[fileKey] {
595595
f, err := val.Open()
596596
if err != nil {
597-
ErrorLogger.Printf("Failed to open file %s: %v", val.Filename, err)
597+
ErrorLogger.Printf("Failed to open file %s: %v", sanitizeLogInput(val.Filename), err)
598598
continue
599599
}
600600

601601
field, err := writer.CreatePart(val.Header)
602602
if err != nil {
603-
ErrorLogger.Printf("Failed to create part for file %s: %v", val.Filename, err)
603+
ErrorLogger.Printf("Failed to create part for file %s: %v", sanitizeLogInput(val.Filename), err)
604604
err = f.Close()
605605
if err != nil {
606606
ErrorLogger.Printf("Failed to close file: %v", err)
@@ -610,12 +610,12 @@ func proxyHandler(response http.ResponseWriter, request *http.Request) {
610610

611611
_, err = io.Copy(field, f)
612612
if err != nil {
613-
ErrorLogger.Printf("Failed to copy file %s: %v", val.Filename, err)
613+
ErrorLogger.Printf("Failed to copy file %s: %v", sanitizeLogInput(val.Filename), err)
614614
}
615615

616616
err = f.Close()
617617
if err != nil {
618-
ErrorLogger.Printf("Failed to close file %s: %v", val.Filename, err)
618+
ErrorLogger.Printf("Failed to close file %s: %v", sanitizeLogInput(val.Filename), err)
619619
}
620620
}
621621
}

0 commit comments

Comments
 (0)