Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add s3 dot segment protocol tests #2166

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 84 additions & 1 deletion smithy-aws-protocol-tests/model/restXml/services/s3.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ service AmazonS3 {
operations: [
ListObjectsV2,
GetBucketLocation,
DeleteObjectTagging
DeleteObjectTagging,
GetObject
],
}

Expand Down Expand Up @@ -343,6 +344,74 @@ operation DeleteObjectTagging {
output: DeleteObjectTaggingOutput
}

@httpRequestTests([
{
id: "S3PreservesLeadingDotSegmentInUriLabel",
documentation: """
S3 clients should not remove dot segments from request paths.
""",
protocol: restXml,
method: "GET",
uri: "/../key.txt",
host: "s3.us-west-2.amazonaws.com",
resolvedHost: "mybucket.s3.us-west-2.amazonaws.com",
body: "",
queryParams: [
"tagging"
],
params: {
Bucket: "mybucket",
Key: "../key.txt"
},
vendorParamsShape: aws.protocoltests.config#AwsConfig,
vendorParams: {
scopedConfig: {
client: {
region: "us-west-2",
},
s3: {
addressing_style: "virtual",
},
},
},
},
{
id: "S3PreservesEmbeddedDotSegmentInUriLabel",
documentation: """
S3 clients should not remove dot segments from request paths.
""",
protocol: restXml,
method: "GET",
uri: "foo/../key.txt",
host: "s3.us-west-2.amazonaws.com",
resolvedHost: "mybucket.s3.us-west-2.amazonaws.com",
body: "",
queryParams: [
"tagging"
],
params: {
Bucket: "mybucket",
Key: "foo/../key.txt"
},
vendorParamsShape: aws.protocoltests.config#AwsConfig,
vendorParams: {
scopedConfig: {
client: {
region: "us-west-2",
},
s3: {
addressing_style: "virtual",
},
},
},
}
])
@http(uri: "/{Bucket}/{Key+}",method: "GET")
operation GetObject {
input: GetObjectRequest,
output: GetObjectOutput,
}


@httpResponseTests([{
id: "GetBucketLocationUnwrappedOutput",
Expand Down Expand Up @@ -441,6 +510,20 @@ structure ListObjectsV2Output {
StartAfter: StartAfter,
}

@input
structure GetObjectRequest {
@httpLabel
@required
Bucket: BucketName,

@httpLabel
@required
Key: ObjectKey,
}

@output
structure GetObjectOutput {}

@input
structure DeleteObjectTaggingRequest {
@httpLabel
Expand Down