mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-13 16:46:55 +00:00
docs(policy): pin the deliberate slash-only path.Clean duplication (#6013)
The policy crate's Go path.Clean port and rustfs-utils' Windows-aware clean look like duplicates but are not interchangeable: S3 ARN/resource matching must treat backslashes as object-name data, never as separators, so adopting the utils version would change policy evaluation semantics on Windows — a security-adjacent behavior change. Record that judgment as bidirectional do-not-merge notes on both implementations, per the issue's adversarial ruling. Comment-only change. Ref rustfs/backlog#1833 (PR7).
This commit is contained in:
@@ -444,6 +444,12 @@ impl LazyBuf {
|
||||
/// The returned path ends in a slash only if it represents a root directory, such as `/` on Unix or `C:/` on Windows.
|
||||
///
|
||||
/// If the result of this process is an empty string, `clean` returns the string `.`.
|
||||
///
|
||||
/// Note: `crates/policy/src/policy/utils/path.rs` deliberately keeps its own
|
||||
/// slash-only Go `path.Clean` port instead of using this function — S3
|
||||
/// ARN/resource matching must not treat backslashes as separators, and this
|
||||
/// Windows-aware version would change policy evaluation semantics on Windows.
|
||||
/// Do not consolidate the two (backlog#1833).
|
||||
pub fn clean(path: &str) -> String {
|
||||
if path.is_empty() {
|
||||
return ".".to_string();
|
||||
|
||||
Reference in New Issue
Block a user