aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3/api_server.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-03-01 12:49:43 +0000
committerAlex <alex@adnab.me>2024-03-01 12:49:43 +0000
commit34086531a842199d6d998bd85d8f65429c4a351d (patch)
tree7bb4a770514e683db047434c0b6908f91b981f19 /src/api/s3/api_server.rs
parentf01883794e475f5dae3d2d4f621b020e1134fa47 (diff)
parent430d0be48c2c4bc789d0f1fd8ef35a34c88a300a (diff)
downloadgarage-34086531a842199d6d998bd85d8f65429c4a351d.tar.gz
garage-34086531a842199d6d998bd85d8f65429c4a351d.zip
Merge pull request 'Backport AWS signature verification refactoring and fixes to v0.8.x' (#744) from backport-735-v0.8.x into main-0.8.x
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/744
Diffstat (limited to 'src/api/s3/api_server.rs')
-rw-r--r--src/api/s3/api_server.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/api/s3/api_server.rs b/src/api/s3/api_server.rs
index ecfb48b6..c266b036 100644
--- a/src/api/s3/api_server.rs
+++ b/src/api/s3/api_server.rs
@@ -17,8 +17,7 @@ use garage_model::key_table::Key;
use crate::generic_server::*;
use crate::s3::error::*;
-use crate::signature::payload::check_payload_signature;
-use crate::signature::streaming::*;
+use crate::signature::verify_request;
use crate::helpers::*;
use crate::s3::bucket::*;
@@ -119,17 +118,7 @@ impl ApiHandler for S3ApiServer {
return handle_options_s3api(garage, &req, bucket_name).await;
}
- let (api_key, mut content_sha256) = check_payload_signature(&garage, "s3", &req).await?;
- let api_key = api_key
- .ok_or_else(|| Error::forbidden("Garage does not support anonymous access yet"))?;
-
- let req = parse_streaming_body(
- &api_key,
- req,
- &mut content_sha256,
- &garage.config.s3_api.s3_region,
- "s3",
- )?;
+ let (req, api_key, content_sha256) = verify_request(&garage, req, "s3").await?;
let bucket_name = match bucket_name {
None => {