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:
Zhengchao An
2026-08-13 03:41:09 +08:00
committed by GitHub
parent d668a9293f
commit 66af487978
2 changed files with 15 additions and 0 deletions
+9
View File
@@ -53,6 +53,15 @@ impl<'a> LazyBuf<'a> {
}
/// copy from golang(path.Clean)
///
/// DELIBERATE DUPLICATION — do not replace with `rustfs_utils::path::clean`.
/// This is a faithful port of Go's slash-only `path.Clean`, which is what S3
/// ARN/resource matching requires: policy resource paths are opaque S3 keys,
/// and a backslash in a key is object-name data, never a separator. The utils
/// version is Windows-aware (`filepath.Clean` semantics: converts backslashes
/// to forward slashes), so swapping it in would change policy evaluation on
/// Windows — a security-adjacent behavior change. Mirror note sits on the
/// utils implementation (backlog#1833).
pub fn clean(path: &str) -> String {
if path.is_empty() {
return ".".into();