refactor: narrow test harness compatibility surfaces (#3592)

This commit is contained in:
安正超
2026-06-19 07:10:52 +08:00
committed by GitHub
parent b14e49e84e
commit b1c6578df1
27 changed files with 384 additions and 105 deletions
+13 -3
View File
@@ -1,9 +1,12 @@
#![no_main]
#[path = "bucket_validation/storage_compat.rs"]
mod storage_compat;
use libfuzzer_sys::fuzz_target;
use crate::storage_compat::ecstore::bucket::utils::{check_bucket_and_object_names, check_list_objs_args, check_valid_bucket_name_strict};
use crate::storage_compat::ecstore::bucket::utils::{
check_bucket_and_object_names, check_list_objs_args, check_valid_bucket_name_strict, is_meta_bucketname,
};
fn parse_case(data: &[u8]) -> (String, String) {
let text = String::from_utf8_lossy(data);
@@ -25,6 +28,7 @@ fuzz_target!(|data: &[u8]| {
let (bucket, object) = parse_case(data);
let strict_bucket_ok = check_valid_bucket_name_strict(&bucket).is_ok();
let valid_bucket_for_object_ops = strict_bucket_ok || is_meta_bucketname(&bucket);
let pair_ok = check_bucket_and_object_names(&bucket, &object).is_ok();
let list_ok = check_list_objs_args(&bucket, &object, &None).is_ok();
@@ -48,10 +52,16 @@ fuzz_target!(|data: &[u8]| {
}
if pair_ok {
assert!(strict_bucket_ok, "accepted bucket/object pair must also satisfy strict bucket validation");
assert!(
valid_bucket_for_object_ops,
"accepted bucket/object pair must satisfy strict bucket validation or meta bucket compatibility"
);
}
if list_ok {
assert!(strict_bucket_ok, "accepted list-object args must also satisfy strict bucket validation");
assert!(
valid_bucket_for_object_ops,
"accepted list-object args must satisfy strict bucket validation or meta bucket compatibility"
);
}
});