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 invalid expires protocol test #2094

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
44 changes: 42 additions & 2 deletions 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 @@ -364,7 +365,6 @@ operation GetBucketLocation {
output: GetBucketLocationOutput,
}


structure CommonPrefix {
Prefix: Prefix,
}
Expand All @@ -380,6 +380,42 @@ structure GetBucketLocationOutput {
LocationConstraint: BucketLocationConstraint,
}

@httpResponseTests([{
id: "GetObjectInvalidExpires",
documentation: """
S3 clients should not fail the request with invalid expires.
GA SDKs should verify the value in ExpiresString param and
new SDKs should verifiy the value in Expires param
Comment on lines +386 to +388
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reword suggestion, if accurate:

Suggested change
S3 clients should not fail the request with invalid expires.
GA SDKs should verify the value in ExpiresString param and
new SDKs should verifiy the value in Expires param
S3 clients should not fail deserialization of the `Expires` header its
value is not a valid timestamp. Instead, the `Expires` parameter of
the response should be left empty, and the `ExpiresString` parameter
should be populated with the raw value of the header.

""",
code: 200,
headers: {
"Expires": "foobar1234"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea, but we could add an ExpiresString member to GetObjectOutput, and update this test to have the following:

Suggested change
},
},
params: {
ExpiresString: "foobar1234"
},

body: "",
protocol: restXml
}])
@http(uri: "/{Bucket}/{Key+}", method: "GET")
@s3UnwrappedXmlOutput
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the actual S3 model has s3UnwrappedXmlOutput on GetObject

operation GetObject {
input: GetObjectRequest,
output: GetObjectOutput,
}

structure GetObjectRequest {
@httpLabel
@required
Bucket: BucketName,

@httpLabel
@required
Key: KeyName,
}

structure GetObjectOutput {
@httpHeader("Expires")
Expires: Expires
}

structure ListObjectsV2Request {
@httpLabel
@required
Expand Down Expand Up @@ -515,10 +551,14 @@ string AccountId

string BucketName

string KeyName

string Delimiter

string DisplayName

string Expires
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a timestamp? From what I understand, clients should try deserializing as a timestamp, but not fail Expires is invalid, right?


enum EncodingType {
@suppress(["EnumShape"])
url
Expand Down