mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-10 23:26:53 +00:00
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:
@@ -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"));
|
||||
|
||||
@@ -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::{
|
||||
|
||||
@@ -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};
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
// limitations under the License.
|
||||
|
||||
pub(crate) mod ecstore {
|
||||
#![allow(unused_imports)]
|
||||
|
||||
pub(crate) use rustfs_ecstore::{config, global, store_api};
|
||||
}
|
||||
|
||||
|
||||
@@ -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};
|
||||
}
|
||||
|
||||
|
||||
@@ -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};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user