Skip to content

Commit

Permalink
update: enable presigned S3 HeadObject requests (#2451)
Browse files Browse the repository at this point in the history
* update: enable presigned S3 HeadObject requests

* add: CHANGELOG entry

* Update CHANGELOG.next.toml

Co-authored-by: John DiSanti <[email protected]>

---------

Co-authored-by: John DiSanti <[email protected]>
  • Loading branch information
Velfi and jdisanti authored Mar 13, 2023
1 parent 4835af9 commit 06b865b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ references = ["smithy-rs#2437", "aws-sdk-rust#600"]
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client" }
author = "ysaito1001"

[[aws-sdk-rust]]
message = "Enable presigning for S3's `HeadObject` operation."
references = ["aws-sdk-rust#753", "smithy-rs#2451"]
meta = { "breaking" = false, "tada" = true, "bug" = false }
author = "Velfi"

[[smithy-rs]]
message = "Smithy members named `send` were previously renamed to `send_value` at codegen time. These will now be called `send` in the generated code."
references = ["smithy-rs#2382"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ internal val PRESIGNABLE_OPERATIONS by lazy {
mapOf(
// S3
// TODO(https://github.com/awslabs/aws-sdk-rust/issues/488) Technically, all S3 operations support presigning
ShapeId.from("com.amazonaws.s3#HeadObject") to PresignableOperation(PayloadSigningType.UNSIGNED_PAYLOAD),
ShapeId.from("com.amazonaws.s3#GetObject") to PresignableOperation(PayloadSigningType.UNSIGNED_PAYLOAD),
ShapeId.from("com.amazonaws.s3#PutObject") to PresignableOperation(PayloadSigningType.UNSIGNED_PAYLOAD),
ShapeId.from("com.amazonaws.s3#UploadPart") to PresignableOperation(PayloadSigningType.UNSIGNED_PAYLOAD),
Expand Down
15 changes: 15 additions & 0 deletions aws/sdk/integration-tests/s3/tests/presigning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,18 @@ async fn test_presigning_object_lambda() -> Result<(), Box<dyn Error>> {
assert_eq!(presigned.uri().to_string(), "https://my-banner-ap-name-123456789012.s3-object-lambda.us-west-2.amazonaws.com/test2.txt?x-id=GetObject&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ANOTREAL%2F20090213%2Fus-west-2%2Fs3-object-lambda%2Faws4_request&X-Amz-Date=20090213T233131Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=027976453050b6f9cca7af80a59c05ee572b462e0fc1ef564c59412b903fcdf2&X-Amz-Security-Token=notarealsessiontoken");
Ok(())
}

#[tokio::test]
async fn test_presigned_head_object() -> Result<(), Box<dyn Error>> {
let presigned = presign_input!(s3::input::HeadObjectInput::builder()
.bucket("bucket")
.key("key")
.build()?);

assert_eq!("HEAD", presigned.method().as_str());
assert_eq!(
presigned.uri().to_string(),
"https://bucket.s3.us-east-1.amazonaws.com/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ANOTREAL%2F20090213%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20090213T233131Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=6b97012e70d5ee3528b5591e0e90c0f45e0fa303506f854eff50ff922751a193&X-Amz-Security-Token=notarealsessiontoken",
);
Ok(())
}

0 comments on commit 06b865b

Please sign in to comment.