Skip to content

Commit b4a971b

Browse files
[AUTO-CHERRYPICK] gh: Address CVE-2025-25204 [Medium] - branch 3.0-dev (#12552)
Co-authored-by: kgodara912 <kshigodara@outlook.com>
1 parent 4bd4a1f commit b4a971b

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

SPECS/gh/CVE-2025-25204.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From bf3a40aef3af6919bba73bfeaadac2d0c169628d Mon Sep 17 00:00:00 2001
2+
From: Fredrik Skogman <kommendorkapten@github.com>
3+
Date: Tue, 11 Feb 2025 09:07:51 +0100
4+
Subject: [PATCH] Exit with error if no matching predicate type exists
5+
6+
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
7+
---
8+
pkg/cmd/attestation/verify/verify.go | 2 +-
9+
pkg/cmd/attestation/verify/verify_test.go | 12 ++++++++++++
10+
2 files changed, 13 insertions(+), 1 deletion(-)
11+
12+
diff --git a/pkg/cmd/attestation/verify/verify.go b/pkg/cmd/attestation/verify/verify.go
13+
index 90242a9fed2..0a8de8b4599 100644
14+
--- a/pkg/cmd/attestation/verify/verify.go
15+
+++ b/pkg/cmd/attestation/verify/verify.go
16+
@@ -236,7 +236,7 @@ func runVerify(opts *Options) error {
17+
filteredAttestations := verification.FilterAttestations(ec.PredicateType, attestations)
18+
if len(filteredAttestations) == 0 {
19+
opts.Logger.Printf(opts.Logger.ColorScheme.Red("✗ No attestations found with predicate type: %s\n"), opts.PredicateType)
20+
- return err
21+
+ return fmt.Errorf("no matching predicate found")
22+
}
23+
attestations = filteredAttestations
24+
25+
diff --git a/pkg/cmd/attestation/verify/verify_test.go b/pkg/cmd/attestation/verify/verify_test.go
26+
index 87ffa96f090..092a009d81e 100644
27+
--- a/pkg/cmd/attestation/verify/verify_test.go
28+
+++ b/pkg/cmd/attestation/verify/verify_test.go
29+
@@ -501,6 +501,18 @@ func TestRunVerify(t *testing.T) {
30+
require.Nil(t, runVerify(&customOpts))
31+
})
32+
33+
+ t.Run("with valid OCI artifact with UseBundleFromRegistry flag and unknown predicate type", func(t *testing.T) {
34+
+ customOpts := publicGoodOpts
35+
+ customOpts.ArtifactPath = "oci://ghcr.io/github/test"
36+
+ customOpts.BundlePath = ""
37+
+ customOpts.UseBundleFromRegistry = true
38+
+ customOpts.PredicateType = "https://predicate.type"
39+
+
40+
+ err := runVerify(&customOpts)
41+
+ require.Error(t, err)
42+
+ require.ErrorContains(t, err, "no matching predicate found")
43+
+ })
44+
+
45+
t.Run("with valid OCI artifact with UseBundleFromRegistry flag but no bundle return from registry", func(t *testing.T) {
46+
customOpts := publicGoodOpts
47+
customOpts.ArtifactPath = "oci://ghcr.io/github/test"

SPECS/gh/gh.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: GitHub official command line tool
22
Name: gh
33
Version: 2.62.0
4-
Release: 5%{?dist}
4+
Release: 6%{?dist}
55
License: MIT
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -18,6 +18,7 @@ Patch1: CVE-2024-54132.patch
1818
Patch2: CVE-2024-45337.patch
1919
Patch3: CVE-2024-45338.patch
2020
Patch5: CVE-2024-53859.patch
21+
Patch6: CVE-2025-25204.patch
2122

2223
BuildRequires: golang < 1.23
2324
BuildRequires: git
@@ -60,6 +61,9 @@ make test
6061
%{_datadir}/zsh/site-functions/_gh
6162

6263
%changelog
64+
* Fri Feb 21 2025 Kshitiz Godara <kgodara@microsoft.com> - 2.62.0-6
65+
- Patch CVE-2025-25204
66+
6367
* Wed Jan 21 2025 Sandeep Karambelkar <skarambelkar@microsoft.com> - 2.62.0-5
6468
- Patch CVE-2024-53859, CVE-2024-53858
6569

0 commit comments

Comments
 (0)