From 8eb12755e4ba1527dfc68ac63a8101503e306a8f Mon Sep 17 00:00:00 2001 From: Joe Anderson Date: Sun, 18 Jan 2026 15:04:56 +0000 Subject: [PATCH 1/2] Allow `bucket` to be missing from presigned post params --- src/api/s3/post_object.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/api/s3/post_object.rs b/src/api/s3/post_object.rs index b9bccae6..09be7e7c 100644 --- a/src/api/s3/post_object.rs +++ b/src/api/s3/post_object.rs @@ -141,10 +141,26 @@ pub async fn handle_post_object( let mut conditions = decoded_policy.into_conditions()?; + // If there are conditions on the bucket name, check these against the actual bucket_name rather + // than the one in params, which is allowed to be absent. + if let Some(conds) = conditions.params.remove("bucket") { + for cond in conds { + let ok = match cond { + Operation::Equal(s) => s.as_str() == bucket_name, + Operation::StartsWith(s) => bucket_name.starts_with(&s), + }; + if !ok { + return Err(Error::bad_request( + "Key 'bucket' has value not allowed in policy", + )); + } + } + } + for (param_key, value) in params.iter() { let param_key = param_key.as_str(); match param_key { - "policy" | "x-amz-signature" => (), // this is always accepted, as it's required to validate other fields + "policy" | "x-amz-signature" | "bucket" => (), // this is always accepted, as it's required to validate other fields "content-type" => { let conds = conditions.params.remove("content-type").ok_or_else(|| { Error::bad_request(format!("Key '{}' is not allowed in policy", param_key)) From a7d6620e18d64e6b2b7a477e546f3c737f8bb6f5 Mon Sep 17 00:00:00 2001 From: rmoff Date: Mon, 12 Jan 2026 17:32:02 +0000 Subject: [PATCH 2/2] Fix typo in error message --- src/rpc/layout/version.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/layout/version.rs b/src/rpc/layout/version.rs index b7902898..a02fce89 100644 --- a/src/rpc/layout/version.rs +++ b/src/rpc/layout/version.rs @@ -507,7 +507,7 @@ impl LayoutVersion { g.compute_maximal_flow()?; if g.get_flow_value()? < (NB_PARTITIONS * self.replication_factor) as i64 { return Err(Error::Message( - "The storage capacity of he cluster is to small. It is \ + "The storage capacity of the cluster is too small. It is \ impossible to store partitions of size 1." .into(), ));