Skip to content

Commit 56b9a22

Browse files
[AUTO-CHERRYPICK] Patch git-lfs for CVE-2025-22870 [Medium] - branch main (#13326)
Co-authored-by: Rohit Rawat <rohitrawat@microsoft.com>
1 parent 9d66287 commit 56b9a22

2 files changed

Lines changed: 53 additions & 4 deletions

File tree

SPECS/git-lfs/CVE-2025-22870.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From 6adba806734b12ec5efc243ba60331e610387037 Mon Sep 17 00:00:00 2001
2+
From: Rohit Rawat <xordux@gmail.com>
3+
Date: Tue, 8 Apr 2025 17:59:35 +0000
4+
Subject: [PATCH] Fix CVE CVE-2025-22870 in git-lfs
5+
Upstream Patch Reference: https://github.com/golang/go/commit/334de7982f8ec959c74470dd709ceedfd6dbd50a.patch
6+
---
7+
vendor/golang.org/x/net/http/httpproxy/proxy.go | 10 ++++++++--
8+
1 file changed, 8 insertions(+), 2 deletions(-)
9+
10+
diff --git a/vendor/golang.org/x/net/http/httpproxy/proxy.go b/vendor/golang.org/x/net/http/httpproxy/proxy.go
11+
index c3bd9a1..864961c 100644
12+
--- a/vendor/golang.org/x/net/http/httpproxy/proxy.go
13+
+++ b/vendor/golang.org/x/net/http/httpproxy/proxy.go
14+
@@ -14,6 +14,7 @@ import (
15+
"errors"
16+
"fmt"
17+
"net"
18+
+ "net/netip"
19+
"net/url"
20+
"os"
21+
"strings"
22+
@@ -180,8 +181,10 @@ func (cfg *config) useProxy(addr string) bool {
23+
if host == "localhost" {
24+
return false
25+
}
26+
- ip := net.ParseIP(host)
27+
- if ip != nil {
28+
+ nip, err := netip.ParseAddr(host)
29+
+ var ip net.IP
30+
+ if err == nil {
31+
+ ip = net.IP(nip.AsSlice())
32+
if ip.IsLoopback() {
33+
return false
34+
}
35+
@@ -363,6 +366,9 @@ type domainMatch struct {
36+
}
37+
38+
func (m domainMatch) match(host, port string, ip net.IP) bool {
39+
+ if ip != nil {
40+
+ return false
41+
+ }
42+
if strings.HasSuffix(host, m.host) || (m.matchHost && host == m.host[1:]) {
43+
return m.port == "" || m.port == port
44+
}
45+
--
46+
2.40.4
47+

SPECS/git-lfs/git-lfs.spec

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Summary: Git extension for versioning large files
33
Name: git-lfs
44
Version: 3.5.1
5-
Release: 4%{?dist}
5+
Release: 5%{?dist}
66
Group: System Environment/Programming
77
Vendor: Microsoft Corporation
88
Distribution: Mariner
@@ -30,6 +30,7 @@ Source0: https://github.com/git-lfs/git-lfs/archive/v%{version}.tar.gz#/%{
3030
Source1: %{name}-%{version}-vendor.tar.gz
3131
Patch0: CVE-2023-45288.patch
3232
Patch1: CVE-2024-53263.patch
33+
Patch2: CVE-2025-22870.patch
3334

3435
BuildRequires: golang
3536
BuildRequires: which
@@ -43,11 +44,9 @@ Requires: git
4344
Git LFS is a command line extension and specification for managing large files with Git
4445

4546
%prep
46-
%autosetup -N
47+
%autosetup -p1 -a1
4748

4849
%build
49-
tar --no-same-owner -xf %{SOURCE1}
50-
%autopatch -p1
5150
export GOPATH=%{our_gopath}
5251
export GOFLAGS="-buildmode=pie -trimpath -mod=vendor -modcacherw -ldflags=-linkmode=external"
5352
go generate ./commands
@@ -80,6 +79,9 @@ git lfs uninstall
8079
%{_mandir}/man5/*
8180

8281
%changelog
82+
* Tue Apr 08 2025 Rohit Rawat <rohitrawat@microsoft.com> - 3.5.1-5
83+
- Patch CVE-2025-22870
84+
8385
* Mon Jan 27 2025 Rohit Rawat <rohitrawat@microsoft.com> - 3.5.1-4
8486
- Add patch for CVE-2024-53263
8587

0 commit comments

Comments
 (0)