don't modify postobject request before validating policy #850

Merged
lx merged 1 commit from trinity-1686a/garage:fix-acl-postobject into main 2024-08-24 10:49:14 +00:00
Showing only changes of commit f190032589 - Show all commits

View file

@ -71,21 +71,11 @@ pub async fn handle_post_object(
} }
if let Ok(content) = HeaderValue::from_str(&field.text().await?) { if let Ok(content) = HeaderValue::from_str(&field.text().await?) {
match name.as_str() { if params.insert(&name, content).is_some() {
"tag" => (/* tag need to be reencoded, but we don't support them yet anyway */), return Err(Error::bad_request(format!(
"acl" => { "Field '{}' provided more than once",
if params.insert("x-amz-acl", content).is_some() { name
return Err(Error::bad_request("Field 'acl' provided more than once")); )));
}
}
_ => {
if params.insert(&name, content).is_some() {
return Err(Error::bad_request(format!(
"Field '{}' provided more than once",
name
)));
}
}
} }
} }
}; };
@ -222,6 +212,8 @@ pub async fn handle_post_object(
))); )));
} }
// if we ever start supporting ACLs, we likely want to map "acl" to x-amz-acl" somewhere
// arround here to make sure the rest of the machinery takes our acl into account.
let headers = get_headers(&params)?; let headers = get_headers(&params)?;
let expected_checksums = ExpectedChecksums { let expected_checksums = ExpectedChecksums {