-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch gh for CVE-2024-45338 #11758
Open
Sumynwa
wants to merge
1
commit into
fasttrack/2.0
Choose a base branch
from
sumsharma/2-0_gh_cve_2024_45338
base: fasttrack/2.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Patch gh for CVE-2024-45338 #11758
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
From 8e66b04771e35c4e4125e8c60334b34e2423effb Mon Sep 17 00:00:00 2001 | ||
From: Roland Shoemaker <[email protected]> | ||
Date: Wed, 04 Dec 2024 09:35:55 -0800 | ||
Subject: [PATCH] html: use strings.EqualFold instead of lowering ourselves | ||
|
||
Instead of using strings.ToLower and == to check case insensitive | ||
equality, just use strings.EqualFold, even when the strings are only | ||
ASCII. This prevents us unnecessarily lowering extremely long strings, | ||
which can be a somewhat expensive operation, even if we're only | ||
attempting to compare equality with five characters. | ||
|
||
Thanks to Guido Vranken for reporting this issue. | ||
|
||
Fixes golang/go#70906 | ||
Fixes CVE-2024-45338 | ||
|
||
Change-Id: I323b919f912d60dab6a87cadfdcac3e6b54cd128 | ||
Reviewed-on: https://go-review.googlesource.com/c/net/+/637536 | ||
LUCI-TryBot-Result: Go LUCI <[email protected]> | ||
Auto-Submit: Gopher Robot <[email protected]> | ||
Reviewed-by: Roland Shoemaker <[email protected]> | ||
Reviewed-by: Tatiana Bradley <[email protected]> | ||
--- | ||
vendor/golang.org/x/net/html/doctype.go | 2 +- | ||
vendor/golang.org/x/net/html/foreign.go | 3 +-- | ||
vendor/golang.org/x/net/html/parse.go | 4 ++-- | ||
3 files changed, 4 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/vendor/golang.org/x/net/html/doctype.go b/vendor/golang.org/x/net/html/doctype.go | ||
index c484e5a..bca3ae9 100644 | ||
--- a/vendor/golang.org/x/net/html/doctype.go | ||
+++ b/vendor/golang.org/x/net/html/doctype.go | ||
@@ -87,7 +87,7 @@ func parseDoctype(s string) (n *Node, quirks bool) { | ||
} | ||
} | ||
if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" && | ||
- strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" { | ||
+ strings.EqualFold(lastAttr.Val, "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") { | ||
quirks = true | ||
} | ||
} | ||
diff --git a/vendor/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go | ||
index 9da9e9d..e8515d8 100644 | ||
--- a/vendor/golang.org/x/net/html/foreign.go | ||
+++ b/vendor/golang.org/x/net/html/foreign.go | ||
@@ -40,8 +40,7 @@ func htmlIntegrationPoint(n *Node) bool { | ||
if n.Data == "annotation-xml" { | ||
for _, a := range n.Attr { | ||
if a.Key == "encoding" { | ||
- val := strings.ToLower(a.Val) | ||
- if val == "text/html" || val == "application/xhtml+xml" { | ||
+ if strings.EqualFold(a.Val, "text/html") || strings.EqualFold(a.Val, "application/xhtml+xml") { | ||
return true | ||
} | ||
} | ||
diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go | ||
index 038941d..cb012d8 100644 | ||
--- a/vendor/golang.org/x/net/html/parse.go | ||
+++ b/vendor/golang.org/x/net/html/parse.go | ||
@@ -1031,7 +1031,7 @@ func inBodyIM(p *parser) bool { | ||
if p.tok.DataAtom == a.Input { | ||
for _, t := range p.tok.Attr { | ||
if t.Key == "type" { | ||
- if strings.ToLower(t.Val) == "hidden" { | ||
+ if strings.EqualFold(t.Val, "hidden") { | ||
// Skip setting framesetOK = false | ||
return true | ||
} | ||
@@ -1459,7 +1459,7 @@ func inTableIM(p *parser) bool { | ||
return inHeadIM(p) | ||
case a.Input: | ||
for _, t := range p.tok.Attr { | ||
- if t.Key == "type" && strings.ToLower(t.Val) == "hidden" { | ||
+ if t.Key == "type" && strings.EqualFold(t.Val, "hidden") { | ||
p.addElement() | ||
p.oe.pop() | ||
return true | ||
-- | ||
2.25.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Summary: GitHub official command line tool | ||
Name: gh | ||
Version: 2.13.0 | ||
Release: 23%{?dist} | ||
Release: 24%{?dist} | ||
License: MIT | ||
Vendor: Microsoft Corporation | ||
Distribution: Mariner | ||
|
@@ -32,6 +32,7 @@ Patch0: fix-relative-time-search-tests.patch | |
Patch1: CVE-2021-43565.patch | ||
Patch2: CVE-2022-32149.patch | ||
Patch3: CVE-2024-54132.patch | ||
Patch4: CVE-2024-45338.patch | ||
|
||
BuildRequires: golang | ||
BuildRequires: git | ||
|
@@ -79,6 +80,9 @@ make test | |
%{_datadir}/zsh/site-functions/_gh | ||
|
||
%changelog | ||
* Fri Jan 03 2025 Sumedh Sharma <[email protected]> - 2.13.0-24 | ||
- Add patch for CVE-2024-45338. | ||
|
||
* Fri Dec 13 2024 Sandeep Karambelkar <[email protected]> - 2.13.0-23 | ||
- Patch CVE-2024-54132 | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, there is no autosetup/autopatch in this spec, you'll need to apply it manually or even better: replace existing patch commands with
%autopatch -p1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will fix this.