refactor: prune storage compatibility re-export allowances (#3579)

* refactor: prune storage compatibility re-export allowances

* fix: reject whitespace-padded dot path segments
This commit is contained in:
安正超
2026-06-18 21:14:24 +08:00
committed by GitHub
parent f3fcdd4ba2
commit 7b0cb9e725
16 changed files with 70 additions and 62 deletions
+6 -19
View File
@@ -137,25 +137,9 @@ pub fn has_bad_path_component(path: &str) -> bool {
i += 1;
}
// Trim whitespace of segment
let mut segment_start = start;
let mut segment_end = i;
while segment_start < segment_end && bytes[segment_start].is_ascii_whitespace() {
segment_start += 1;
}
while segment_end > segment_start && bytes[segment_end - 1].is_ascii_whitespace() {
segment_end -= 1;
}
// Check for ".." or "."
match segment_end - segment_start {
2 if segment_start + 1 < n && bytes[segment_start] == b'.' && bytes[segment_start + 1] == b'.' => {
return true;
}
1 if bytes[segment_start] == b'.' => {
return true;
}
// Trim whitespace of segment and check for ".." or "."
match path[start..i].trim() {
"." | ".." => return true,
_ => {}
}
@@ -436,6 +420,9 @@ mod tests {
assert!(!is_valid_object_prefix("prefix/./other"));
assert!(!is_valid_object_prefix("a/../b/../c"));
assert!(!is_valid_object_prefix("a/./b/./c"));
assert!(!is_valid_object_prefix("\x0b./object"));
assert!(!is_valid_object_prefix("prefix/\x0b../object"));
assert!(!is_valid_object_prefix("\x0b.\\\\object"));
// Invalid cases - double slashes
assert!(!is_valid_object_prefix("prefix//with//double//slashes"));
-2
View File
@@ -13,8 +13,6 @@
// limitations under the License.
pub(crate) mod ecstore {
#![allow(unused_imports)]
pub(crate) use rustfs_ecstore::{data_usage, disk, error, global, store, store_api};
}
pub(crate) use self::ecstore::{
-2
View File
@@ -13,7 +13,5 @@
// limitations under the License.
pub(crate) mod ecstore {
#![allow(unused_imports)]
pub(crate) use rustfs_ecstore::{config, error, global, notification_sys, store};
}
-2
View File
@@ -13,8 +13,6 @@
// limitations under the License.
pub(crate) mod ecstore {
#![allow(unused_imports)]
pub(crate) use rustfs_ecstore::{config, global, store_api};
}
-2
View File
@@ -13,7 +13,5 @@
// limitations under the License.
pub(crate) mod ecstore {
#![allow(unused_imports)]
pub(crate) use rustfs_ecstore::{bucket, data_usage, global, pools, resolve_object_store_handle};
}
@@ -13,8 +13,6 @@
// limitations under the License.
mod ecstore {
#![allow(unused_imports)]
pub(super) use rustfs_ecstore::{bucket, error, resolve_object_store_handle, store, store_api};
}
use self::ecstore::{
@@ -13,8 +13,6 @@
// limitations under the License.
pub(crate) mod ecstore {
#![allow(unused_imports)]
pub(crate) use rustfs_ecstore::{error, resolve_object_store_handle, set_disk, store, store_api};
}
-2
View File
@@ -14,8 +14,6 @@
use http::HeaderMap;
pub(crate) mod ecstore {
#![allow(unused_imports)]
pub(crate) use rustfs_ecstore::{
bucket, cache_value, config, data_usage, disk, error, global, pools, resolve_object_store_handle, set_disk, store,
store_api, store_utils,
@@ -13,7 +13,5 @@
// limitations under the License.
pub(crate) mod ecstore {
#![allow(unused_imports)]
pub(crate) use rustfs_ecstore::{bucket, client, disk, endpoints, global, pools, store, tier};
}