Skip to content

Commit 30334fe

Browse files
CBL-Mariner-Botazurelinux-securityjslobodzian
authored
Merge PR "[AUTO-CHERRYPICK] [AutoPR- Security] Patch local-path-provisioner for CVE-2025-65637 [HIGH] - branch main" #15354
Co-authored-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> Co-authored-by: jslobodzian <joslobo@microsoft.com>
1 parent 681371c commit 30334fe

2 files changed

Lines changed: 99 additions & 1 deletion

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
From b050f79897597e999396c27aab8e57a01d88db23 Mon Sep 17 00:00:00 2001
2+
From: AllSpark <allspark@microsoft.com>
3+
Date: Mon, 8 Dec 2025 09:54:26 +0000
4+
Subject: [PATCH] vendor/logrus: Fix potential DoS in Writer() by scanning
5+
input in 64KB chunks and trimming newlines. Add comments and finalizer. Based
6+
on upstream patches.
7+
8+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
9+
Upstream-reference: AI Backport of https://github.com/sirupsen/logrus/pull/1376.patch
10+
---
11+
vendor/github.com/Sirupsen/logrus/writer.go | 34 ++++++++++++++++++++-
12+
1 file changed, 33 insertions(+), 1 deletion(-)
13+
14+
diff --git a/vendor/github.com/Sirupsen/logrus/writer.go b/vendor/github.com/Sirupsen/logrus/writer.go
15+
index f74d2aa..4bff841 100644
16+
--- a/vendor/github.com/Sirupsen/logrus/writer.go
17+
+++ b/vendor/github.com/Sirupsen/logrus/writer.go
18+
@@ -4,16 +4,20 @@ import (
19+
"bufio"
20+
"io"
21+
"runtime"
22+
+ "strings"
23+
)
24+
25+
+// Writer returns an io.Writer that writes to the logger at the info log level
26+
func (logger *Logger) Writer() *io.PipeWriter {
27+
return logger.WriterLevel(InfoLevel)
28+
}
29+
30+
+// WriterLevel returns an io.Writer that writes to the logger at the given log level
31+
func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
32+
reader, writer := io.Pipe()
33+
34+
var printFunc func(args ...interface{})
35+
+ // Determine which log function to use based on the specified log level
36+
switch level {
37+
case DebugLevel:
38+
printFunc = logger.Debug
39+
@@ -31,23 +35,51 @@ func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
40+
printFunc = logger.Print
41+
}
42+
43+
+ // Start a new goroutine to scan the input and write it to the logger using the specified print function.
44+
+ // It splits the input into chunks of up to 64KB to avoid buffer overflows.
45+
go logger.writerScanner(reader, printFunc)
46+
+
47+
+ // Set a finalizer function to close the writer when it is garbage collected
48+
runtime.SetFinalizer(writer, writerFinalizer)
49+
50+
return writer
51+
}
52+
53+
+// writerScanner scans the input from the reader and writes it to the logger
54+
func (logger *Logger) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
55+
scanner := bufio.NewScanner(reader)
56+
+
57+
+ // Set the buffer size to the maximum token size to avoid buffer overflows
58+
+ scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), bufio.MaxScanTokenSize)
59+
+
60+
+ // Define a split function to split the input into chunks of up to 64KB
61+
+ chunkSize := 64 * 1024 // 64KB
62+
+ splitFunc := func(data []byte, atEOF bool) (int, []byte, error) {
63+
+ if len(data) > chunkSize {
64+
+ return chunkSize, data[:chunkSize], nil
65+
+ }
66+
+
67+
+ return len(data), data, nil
68+
+ }
69+
+
70+
+ //Use the custom split function to split the input
71+
+ scanner.Split(splitFunc)
72+
+
73+
+ // Scan the input and write it to the logger using the specified print function
74+
for scanner.Scan() {
75+
- printFunc(scanner.Text())
76+
+ printFunc(strings.TrimRight(scanner.Text(), "\r\n"))
77+
}
78+
+
79+
+ // If there was an error while scanning the input, log an error
80+
if err := scanner.Err(); err != nil {
81+
logger.Errorf("Error while reading from Writer: %s", err)
82+
}
83+
+
84+
+ // Close the reader when we are done
85+
reader.Close()
86+
}
87+
88+
+// WriterFinalizer is a finalizer function that closes then given writer when it is garbage collected
89+
func writerFinalizer(writer *io.PipeWriter) {
90+
writer.Close()
91+
}
92+
--
93+
2.45.4
94+

SPECS/local-path-provisioner/local-path-provisioner.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Provides a way for the Kubernetes users to utilize the local storage in each node
22
Name: local-path-provisioner
33
Version: 0.0.21
4-
Release: 19%{?dist}
4+
Release: 20%{?dist}
55
License: ASL 2.0
66
URL: https://github.com/rancher/local-path-provisioner
77
Group: Applications/Text
@@ -13,6 +13,7 @@ Source0: https://github.com/rancher/%{name}/archive/refs/tags/v%{version}
1313
Patch0: CVE-2022-21698.patch
1414
Patch1: CVE-2021-44716.patch
1515
Patch2: CVE-2023-44487.patch
16+
Patch3: CVE-2025-65637.patch
1617

1718
BuildRequires: golang
1819

@@ -34,6 +35,9 @@ install local-path-provisioner %{buildroot}%{_bindir}/local-path-provisioner
3435
%{_bindir}/local-path-provisioner
3536

3637
%changelog
38+
* Mon Dec 08 2025 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 0.0.21-20
39+
- Patch for CVE-2025-65637
40+
3741
* Thu Sep 04 2025 Akhila Guruju <v-guakhila@microsoft.com> - 0.0.21-19
3842
- Bump release to rebuild with golang
3943

0 commit comments

Comments
 (0)