From c836c3dcdcfe7775ff10086d61cbfb2bdc115f57 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Oct 2025 17:33:35 +0200 Subject: [PATCH 1/2] doc: Add documentation explaining URL serialization and password handling Co-authored-by: Byron <63622+Byron@users.noreply.github.com> --- gix-url/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gix-url/src/lib.rs b/gix-url/src/lib.rs index dfbfb6b045b..a2efe224e52 100644 --- a/gix-url/src/lib.rs +++ b/gix-url/src/lib.rs @@ -85,6 +85,18 @@ pub enum ArgumentSafety<'a> { /// parameters, but never be accepted as an instance of this type and then reconstructed, to maintain /// validity guarantees. /// +/// # Serialization +/// +/// This type does not implement `Into` or `From for String` because URLs can contain +/// non-UTF-8 sequences in the path component. Use [to_bstring()](Url::to_bstring()) for lossless +/// serialization, or use the [`Display`](std::fmt::Display) trait for a UTF-8 representation that +/// redacts passwords for safe logging. +/// +/// When the `serde` feature is enabled, this type implements `serde::Serialize` and `serde::Deserialize`, +/// which will serialize *all* fields including passwords. The password is never serialized through the +/// `Display` trait or in any other context unless the `serde` feature is enabled and serde serialization +/// is explicitly used. +/// /// # Security Warning /// /// URLs may contain passwords and using standard [formatting](std::fmt::Display) will redact From 78898a7987c181d1d04d917e308bba10eeac1e41 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 22 Oct 2025 17:37:13 +0200 Subject: [PATCH 2/2] Adjust documentation to be a bit less verbose. --- gix-url/src/lib.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gix-url/src/lib.rs b/gix-url/src/lib.rs index a2efe224e52..d5cf6210b15 100644 --- a/gix-url/src/lib.rs +++ b/gix-url/src/lib.rs @@ -76,7 +76,7 @@ pub enum ArgumentSafety<'a> { /// A URL with support for specialized git related capabilities. /// -/// Additionally there is support for [deserialization](Url::from_bytes()) and [serialization](Url::to_bstring()). +/// Additionally, there is support for [deserialization](Url::from_bytes()) and [serialization](Url::to_bstring()). /// /// # Mutability Warning /// @@ -87,15 +87,13 @@ pub enum ArgumentSafety<'a> { /// /// # Serialization /// -/// This type does not implement `Into` or `From for String` because URLs can contain -/// non-UTF-8 sequences in the path component. Use [to_bstring()](Url::to_bstring()) for lossless -/// serialization, or use the [`Display`](std::fmt::Display) trait for a UTF-8 representation that -/// redacts passwords for safe logging. +/// This type does not implement `Into`, `From for String` because URLs +/// can contain non-UTF-8 sequences in the path component when parsed from raw bytes. +/// Use [to_bstring()](Url::to_bstring()) for lossless serialization, or use the [`Display`](std::fmt::Display) +/// trait for a UTF-8 representation that redacts passwords for safe logging. /// /// When the `serde` feature is enabled, this type implements `serde::Serialize` and `serde::Deserialize`, -/// which will serialize *all* fields including passwords. The password is never serialized through the -/// `Display` trait or in any other context unless the `serde` feature is enabled and serde serialization -/// is explicitly used. +/// which will serialize *all* fields, including the password. /// /// # Security Warning ///