History

doc: Add documentation explaining URL serialization and password handling

copilot-swe-agent[bot] committed 1 year ago

Commit c836c3d1 parent 8699d0f1 file · +12 −0Browse files

Unified · Split

gix-url/src/lib.rs+12−0
@@ -85,6 +85,18 @@ pub enum ArgumentSafety<'a> { · 84 unmodified lines
8585 /// parameters, but never be accepted as an instance of this type and then reconstructed, to maintain
8686 /// validity guarantees.
8787 ///
88+/// # Serialization
89+///
90+/// This type does not implement `Into<String>` or `From<Url> for String` because URLs can contain
91+/// non-UTF-8 sequences in the path component. Use [to_bstring()](Url::to_bstring()) for lossless
92+/// serialization, or use the [`Display`](std::fmt::Display) trait for a UTF-8 representation that
93+/// redacts passwords for safe logging.
94+///
95+/// When the `serde` feature is enabled, this type implements `serde::Serialize` and `serde::Deserialize`,
96+/// which will serialize *all* fields including passwords. The password is never serialized through the
97+/// `Display` trait or in any other context unless the `serde` feature is enabled and serde serialization
98+/// is explicitly used.
99+///
88100 /// # Security Warning
89101 ///
90102 /// URLs may contain passwords and using standard [formatting](std::fmt::Display) will redact