public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rust-onefetch] rawhide: Fix stray patch
@ 2026-10-08 18:19 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-10-08 18:19 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/rust-onefetch
Branch : rawhide
Commit : 5769ac3046db986b8f15d6e17d4d42f80819134d
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date   : 2026-10-08T18:42:23+01:00
Stats  : +2/-279 in 5 file(s)
URL    : https://src.fedoraproject.org/rpms/rust-onefetch/c/5769ac3046db986b8f15d6e17d4d42f80819134d?branch=rawhide

Log:
Fix stray patch

---
diff --git a/1829.patch b/1829.patch
deleted file mode 100644
index 44ee927..0000000
--- a/1829.patch
+++ /dev/null
@@ -1,256 +0,0 @@
-From ea83302efb7cc18188bb061a574bde163ab3927c Mon Sep 17 00:00:00 2001
-From: Gogs <gogs@fake.local>
-Date: Fri, 7 Aug 2026 22:39:50 +0800
-Subject: [PATCH 1/4] fix: strip control characters from info field values
-
-Version and Project (repo name) fall back to a package.json/Cargo.toml
-manifest field when git tags/remote are absent, and those values were
-styled and written to the terminal with no filtering of control
-characters. A manifest field has no character restrictions, unlike a
-git tag/ref, so a crafted manifest could inject terminal escape
-sequences into onefetch's own output.
-
-Adds sanitize_for_display in InfoField::style_value, the single choke
-point every field's value already passes through, so the fix covers
-every manifest-derived field, not just version.
----
- src/info/utils/info_field.rs | 15 +++++++++++++--
- 1 file changed, 13 insertions(+), 2 deletions(-)
-
-diff --git a/src/info/utils/info_field.rs b/src/info/utils/info_field.rs
-index 52d69011c..99fc0bb99 100644
---- a/src/info/utils/info_field.rs
-+++ b/src/info/utils/info_field.rs
-@@ -2,6 +2,18 @@ use crate::{info::utils::get_style, ui::text_colors::TextColors};
- use owo_colors::OwoColorize;
- use std::fmt;
- 
-+/// Replaces control characters (which can include terminal escape sequences)
-+/// with the Unicode replacement character, since some field values (a
-+/// project manifest's version, name, description, or license, for example)
-+/// come from data with no character restrictions and shouldn't be trusted
-+/// to display as-is. `\n` is preserved since some fields intentionally span
-+/// multiple lines.
-+fn sanitize_for_display(s: &str) -> String {
-+    s.chars()
-+        .map(|c| if c != '\n' && c.is_control() { '\u{FFFD}' } else { c })
-+        .collect()
-+}
-+
- #[typetag::serialize]
- pub trait InfoField {
-     fn value(&self) -> String;
-@@ -46,8 +58,7 @@ pub trait InfoField {
-             return None;
-         }
-         let style = get_style(false, text_colors.info);
--        let styled_lines: Vec<String> = self
--            .value()
-+        let styled_lines: Vec<String> = sanitize_for_display(&self.value())
-             .lines()
-             .map(|line| format!("{}", line.style(style)))
-             .collect();
-
-From 4af537777ff6b65959e50cdb258de728d6bbdf68 Mon Sep 17 00:00:00 2001
-From: Gogs <gogs@fake.local>
-Date: Sun, 9 Aug 2026 17:52:04 +0800
-Subject: [PATCH 2/4] test(info_field): add unit tests for sanitize_for_display
-
-Covers the control-byte-to-replacement-character behavior directly
-(including an OSC title-set style payload), confirms newlines and
-normal printable text are left untouched, and adds a style_value-level
-test exercising the sanitizer through the same path real field values
-take.
----
- src/info/utils/info_field.rs | 36 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 36 insertions(+)
-
-diff --git a/src/info/utils/info_field.rs b/src/info/utils/info_field.rs
-index 99fc0bb99..51586ef8f 100644
---- a/src/info/utils/info_field.rs
-+++ b/src/info/utils/info_field.rs
-@@ -131,4 +131,40 @@ mod test {
-         info.write_styled(&mut buffer, false, &colors).unwrap();
-         assert_eq!(buffer, "", "It should not write anything");
-     }
-+
-+    #[test]
-+    fn test_sanitize_for_display_strips_control_chars() {
-+        // ESC ] 0 ; PWNED BEL, an OSC title-set sequence
-+        let input = "1.0.0\u{1b}]0;PWNED\u{07}";
-+        let sanitized = sanitize_for_display(input);
-+        assert_eq!(sanitized, "1.0.0\u{FFFD}]0;PWNED\u{FFFD}");
-+        assert!(!sanitized.contains('\u{1b}'));
-+        assert!(!sanitized.contains('\u{07}'));
-+    }
-+
-+    #[test]
-+    fn test_sanitize_for_display_preserves_newlines() {
-+        let input = "line one\nline two";
-+        assert_eq!(sanitize_for_display(input), input);
-+    }
-+
-+    #[test]
-+    fn test_sanitize_for_display_leaves_normal_text_untouched() {
-+        let input = "some normal description, with punctuation! 42";
-+        assert_eq!(sanitize_for_display(input), input);
-+    }
-+
-+    #[test]
-+    fn test_style_value_strips_control_chars_from_field() {
-+        // style_value wraps the value in its own SGR escape codes, so this
-+        // checks for the injected control bytes specifically, not for the
-+        // absence of ESC entirely. The harmless leftover text ("]0;PWNED")
-+        // is expected to remain once the ESC/BEL bytes around it are gone.
-+        let colors = TextColors::new(&[], DynColors::Rgb(0xFF, 0xFF, 0xFF));
-+        let info = InfoFieldImpl("1.0.0\u{1b}]0;PWNED\u{07}");
-+        let styled = info.style_value(&colors).unwrap();
-+        assert!(!styled.contains('\u{07}'));
-+        assert!(styled.contains("1.0.0"));
-+        assert_eq!(styled.matches('\u{FFFD}').count(), 2);
-+    }
- }
-
-From f6823dbfc62172befb0bf83d3e15473510b8c9b8 Mon Sep 17 00:00:00 2001
-From: o2sh <hjajiossama@gmail.com>
-Date: Mon, 28 Sep 2026 13:06:47 +0000
-Subject: [PATCH 3/4] fix: sanitize info field values per line
-
-Sanitize each line after splitting so CRLF text doesn't gain a trailing
-U+FFFD, and drop the now-unneeded `\n` exception. Rename
-`sanitize_for_display` to `sanitize`, trim comments, and replace redundant
-tests with coverage for CRLF, C1 CSI (U+009B) and lone `\r`.
-
-Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
----
- src/info/utils/info_field.rs | 60 +++++++++++++++++++-----------------
- 1 file changed, 31 insertions(+), 29 deletions(-)
-
-diff --git a/src/info/utils/info_field.rs b/src/info/utils/info_field.rs
-index 51586ef8f..b4cea3d76 100644
---- a/src/info/utils/info_field.rs
-+++ b/src/info/utils/info_field.rs
-@@ -2,15 +2,11 @@ use crate::{info::utils::get_style, ui::text_colors::TextColors};
- use owo_colors::OwoColorize;
- use std::fmt;
- 
--/// Replaces control characters (which can include terminal escape sequences)
--/// with the Unicode replacement character, since some field values (a
--/// project manifest's version, name, description, or license, for example)
--/// come from data with no character restrictions and shouldn't be trusted
--/// to display as-is. `\n` is preserved since some fields intentionally span
--/// multiple lines.
--fn sanitize_for_display(s: &str) -> String {
-+/// Replaces control characters so untrusted repository data can't inject
-+/// terminal escape sequences.
-+fn sanitize(s: &str) -> String {
-     s.chars()
--        .map(|c| if c != '\n' && c.is_control() { '\u{FFFD}' } else { c })
-+        .map(|c| if c.is_control() { '\u{FFFD}' } else { c })
-         .collect()
- }
- 
-@@ -58,9 +54,9 @@ pub trait InfoField {
-             return None;
-         }
-         let style = get_style(false, text_colors.info);
--        let styled_lines: Vec<String> = sanitize_for_display(&self.value())
-+        let styled_lines: Vec<String> = value
-             .lines()
--            .map(|line| format!("{}", line.style(style)))
-+            .map(|line| format!("{}", sanitize(line).style(style)))
-             .collect();
-         Some(styled_lines.join("\n"))
-     }
-@@ -133,33 +129,23 @@ mod test {
-     }
- 
-     #[test]
--    fn test_sanitize_for_display_strips_control_chars() {
--        // ESC ] 0 ; PWNED BEL, an OSC title-set sequence
--        let input = "1.0.0\u{1b}]0;PWNED\u{07}";
--        let sanitized = sanitize_for_display(input);
--        assert_eq!(sanitized, "1.0.0\u{FFFD}]0;PWNED\u{FFFD}");
--        assert!(!sanitized.contains('\u{1b}'));
--        assert!(!sanitized.contains('\u{07}'));
-+    fn test_sanitize_strips_control_chars() {
-+        // OSC set-title sequence
-+        assert_eq!(
-+            sanitize("1.0.0\u{1b}]0;PWNED\u{07}"),
-+            "1.0.0\u{FFFD}]0;PWNED\u{FFFD}"
-+        );
-     }
- 
-     #[test]
--    fn test_sanitize_for_display_preserves_newlines() {
--        let input = "line one\nline two";
--        assert_eq!(sanitize_for_display(input), input);
--    }
--
--    #[test]
--    fn test_sanitize_for_display_leaves_normal_text_untouched() {
-+    fn test_sanitize_leaves_normal_text_untouched() {
-         let input = "some normal description, with punctuation! 42";
--        assert_eq!(sanitize_for_display(input), input);
-+        assert_eq!(sanitize(input), input);
-     }
- 
-     #[test]
-     fn test_style_value_strips_control_chars_from_field() {
--        // style_value wraps the value in its own SGR escape codes, so this
--        // checks for the injected control bytes specifically, not for the
--        // absence of ESC entirely. The harmless leftover text ("]0;PWNED")
--        // is expected to remain once the ESC/BEL bytes around it are gone.
-+        // Output still contains ESC from our own color codes.
-         let colors = TextColors::new(&[], DynColors::Rgb(0xFF, 0xFF, 0xFF));
-         let info = InfoFieldImpl("1.0.0\u{1b}]0;PWNED\u{07}");
-         let styled = info.style_value(&colors).unwrap();
-@@ -167,4 +153,20 @@ mod test {
-         assert!(styled.contains("1.0.0"));
-         assert_eq!(styled.matches('\u{FFFD}').count(), 2);
-     }
-+
-+    #[test]
-+    fn test_style_value_crlf_lines() {
-+        let colors = TextColors::new(&[], DynColors::Rgb(0xFF, 0xFF, 0xFF));
-+        let styled = InfoFieldImpl("line one\r\nline two")
-+            .style_value(&colors)
-+            .unwrap();
-+        assert_eq!(styled.lines().count(), 2);
-+        assert!(!styled.contains('\u{FFFD}'), "{styled:?}");
-+    }
-+
-+    #[test]
-+    fn test_sanitize_strips_c1_and_cr() {
-+        assert_eq!(sanitize("1.0\u{9b}2J"), "1.0\u{FFFD}2J");
-+        assert_eq!(sanitize("evil\rOK"), "evil\u{FFFD}OK");
-+    }
- }
-
-From c42f977d543a02993ee048620c359bf1cf7d08ab Mon Sep 17 00:00:00 2001
-From: o2sh <hjajiossama@gmail.com>
-Date: Mon, 28 Sep 2026 13:46:35 +0000
-Subject: [PATCH 4/4] refactor: simplify sanitize with str::replace
-
-Refs: CVE-2026-100866
-
-Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
----
- src/info/utils/info_field.rs | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
-diff --git a/src/info/utils/info_field.rs b/src/info/utils/info_field.rs
-index b4cea3d76..843ecfa64 100644
---- a/src/info/utils/info_field.rs
-+++ b/src/info/utils/info_field.rs
-@@ -5,9 +5,7 @@ use std::fmt;
- /// Replaces control characters so untrusted repository data can't inject
- /// terminal escape sequences.
- fn sanitize(s: &str) -> String {
--    s.chars()
--        .map(|c| if c.is_control() { '\u{FFFD}' } else { c })
--        .collect()
-+    s.replace(char::is_control, "\u{FFFD}")
- }
- 
- #[typetag::serialize]

diff --git a/onefetch-fix-metadata-auto.diff b/onefetch-fix-metadata-auto.diff
index a2a56be..90f0d2b 100644
--- a/onefetch-fix-metadata-auto.diff
+++ b/onefetch-fix-metadata-auto.diff
@@ -1,5 +1,5 @@
 --- onefetch-3.0.0/Cargo.toml	2006-07-24T01:21:28+00:00
-+++ onefetch-3.0.0/Cargo.toml	2026-10-08T13:55:08.027197+00:00
++++ onefetch-3.0.0/Cargo.toml	2026-10-08T17:41:43.969681+00:00
 @@ -194,8 +194,3 @@
  version = "2.4.0"
  default-features = false

diff --git a/onefetch-fix-metadata.diff b/onefetch-fix-metadata.diff
index 557447e..4560aac 100644
--- a/onefetch-fix-metadata.diff
+++ b/onefetch-fix-metadata.diff
@@ -1,5 +1,5 @@
 --- onefetch-3.0.0/Cargo.toml	2006-07-24T01:21:28+00:00
-+++ onefetch-3.0.0/Cargo.toml	2026-10-08T13:55:12.095390+00:00
++++ onefetch-3.0.0/Cargo.toml	2026-10-08T17:41:43.971164+00:00
 @@ -69,10 +69,6 @@
  name = "onefetch"
  path = "src/main.rs"

diff --git a/rust-onefetch.spec b/rust-onefetch.spec
index 269674c..35ea6a1 100644
--- a/rust-onefetch.spec
+++ b/rust-onefetch.spec
@@ -36,12 +36,6 @@ Patch:          onefetch-fix-metadata.diff
 # * Downstream-only: revert the source-code change for gix 0.86+ so we can
 #   temporarily keep using gix 0.85.
 Patch10:        0001-Revert-chore-deps-Update-Rust-crate-gix-to-0.86.0-18.patch
-# * fix: strip control characters from info field values:
-#   https://github.com/o2sh/onefetch/pull/1829
-# * Fixes: Info field values aren't stripped of terminal escape sequences:
-#   https://github.com/o2sh/onefetch/issues/1828, CVE-2026-100866, RHBZ#2542292,
-#   RHBZ#2542294
-Patch11:        https://github.com/o2sh/onefetch/pull/1829.patch
 
 BuildRequires:  cargo-rpm-macros >= 26
 BuildRequires:  help2man

diff --git a/rust2rpm.toml b/rust2rpm.toml
index ddd7a87..94ffb5b 100644
--- a/rust2rpm.toml
+++ b/rust2rpm.toml
@@ -49,21 +49,6 @@ temporarily keep using gix 0.85.\
 """,
 ]
 
-[[package.extra-patches]]
-number = 11
-file = "https://github.com/o2sh/onefetch/pull/1829.patch"
-comments = [
-    """\
-fix: strip control characters from info field values: \
-https://github.com/o2sh/onefetch/pull/1829\
-""",
-    """\
-Fixes: Info field values aren't stripped of terminal escape sequences: \
-https://github.com/o2sh/onefetch/issues/1828, CVE-2026-100866, \
-RHBZ#2542292, RHBZ#2542294\
-""",
-]
-
 [requires]
 build = [
     "help2man",

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-08 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-08 18:19 [rpms/rust-onefetch] rawhide: Fix stray patch Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox