Skip to content

Ensure S3 presigned default expires time is not changing - #861

Merged
trevorrowe merged 1 commit into
aws:aws-sdk-v1from
didacte:bugfix/s3-presigned-default-expires
Jul 6, 2015
Merged

Ensure S3 presigned default expires time is not changing#861
trevorrowe merged 1 commit into
aws:aws-sdk-v1from
didacte:bugfix/s3-presigned-default-expires

Conversation

@j15e

@j15e j15e commented Jul 3, 2015

Copy link
Copy Markdown

It occurred to us that signatures end up invalid randomly because the default signature time is computed twice and we can end up with a policy that was signed for a policy with an expiration time 1 second earlier.

To be specific, the policy is computed twice inside the fields method which uses the formation_expiration twice too, which in turn computes Time.now at two different times.

https://github.com/didacte/aws-sdk-ruby/blob/bugfix/s3-presigned-default-expires/lib/aws/s3/presigned_post.rb#L345-L351

@see marcel/aws-s3#54 (similar issue)

It occurred to us that signatures end up invalid randomly because the default signature time is computed twice and we can end up with a policy that was signed for a policy with an expiration time 1 second earlier.

To be specific, the policy is computed twice inside the `fields` method which uses the `formation_expiration` twice too, which in turn computes `Time.now` at two different times.

@see marcel/aws-s3#54 (similar issue)
trevorrowe added a commit that referenced this pull request Jul 6, 2015
Ensure S3 presigned default expires time is not changing
@trevorrowe
trevorrowe merged commit f5a3664 into aws:aws-sdk-v1 Jul 6, 2015
@trevorrowe

Copy link
Copy Markdown
Contributor

Good catch! Thanks for the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants