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

Move expires timestamp in SignatureV4 to be generated before startTimestamp #1325

Merged
merged 9 commits into from Aug 4, 2017

Conversation

Projects
None yet
4 participants
@daum
Contributor

daum commented Jul 6, 2017

As described in issue #1322 an edge case of using exactly 1 week expiration when a second rolls between
the startTimestamp calculation via time() and the expires timestamp can cause incorrect exceptions. This
occurs when the second rolls over (ie 12:01:01.9999999 to 12:02:02.00000) between the startTime (time())
and endTime conversion from strtotime(). This causes the exception of the expiration must be less than a week
to be thrown. By moving the endTime to be converted before startTime this guarantees that will never occur.

daum added some commits Jul 6, 2017

Moved expires timestamp in SignatureV4 to be generated before startTi…
…mestamp for edge case of second roll overs.

As described in issue #1322 an edge case of using exactly 1 week expiration when a second rolls between
the startTimestamp calculation via time() and the expires timestamp can cause incorrect exceptions. This
occurs when the second rolls over (ie 12:01:01.9999999 to 12:02:02.00000) between the startTime (time())
and endTime conversion from strtotime().  This causes the exception of the expiration must be less than a week
to be thrown.  By moving the endTime to be converted before startTime this guarantees that will never occur.
Updated Signature Presign tests to not use reflection to test differe…
…nt expiration timestamp formats so it only uses public API.
@codecov-io

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io Jul 7, 2017

Codecov Report

Merging #1325 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1325      +/-   ##
============================================
+ Coverage     91.87%   91.87%   +<.01%     
- Complexity     2465     2466       +1     
============================================
  Files           142      142              
  Lines          7518     7523       +5     
============================================
+ Hits           6907     6912       +5     
  Misses          611      611
Impacted Files Coverage Δ Complexity Δ
src/Signature/SignatureV4.php 100% <100%> (ø) 45 <6> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c34cf0...851c29f. Read the comment docs.

codecov-io commented Jul 7, 2017

Codecov Report

Merging #1325 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1325      +/-   ##
============================================
+ Coverage     91.87%   91.87%   +<.01%     
- Complexity     2465     2466       +1     
============================================
  Files           142      142              
  Lines          7518     7523       +5     
============================================
+ Hits           6907     6912       +5     
  Misses          611      611
Impacted Files Coverage Δ Complexity Δ
src/Signature/SignatureV4.php 100% <100%> (ø) 45 <6> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c34cf0...851c29f. Read the comment docs.

@imshashank imshashank requested a review from kstich Jul 7, 2017

@daum

This comment has been minimized.

Show comment
Hide comment
@daum

daum Jul 11, 2017

Contributor

@imshashank All set just updated those lines.

Contributor

daum commented Jul 11, 2017

@imshashank All set just updated those lines.

@kstich

I think this will end up requiring a deeper change to convertExpires or convertToTimestamp to handle a start time to guarantee this is a fix.

@daum

This comment has been minimized.

Show comment
Hide comment
@daum

daum Jul 24, 2017

Contributor

@kstich @imshashank Just wanted to check in on this to see if you think it will be integrated soon or if there are other questions.

Contributor

daum commented Jul 24, 2017

@kstich @imshashank Just wanted to check in on this to see if you think it will be integrated soon or if there are other questions.

Added relativeTimeBase option to specify a base time for all relative…
… timestamps on a presign request. Defaults to current time.
Show outdated Hide outdated src/Signature/SignatureV4.php
@kstich

kstich approved these changes Aug 3, 2017

@imshashank

Minor formatting fixes. Besides that LGTM

Show outdated Hide outdated src/Signature/SignatureV4.php
Show outdated Hide outdated src/Signature/SignatureV4.php

@kstich kstich merged commit e49a541 into aws:master Aug 4, 2017

2 of 3 checks passed

codecov/project 91.87% (target 92%)
Details
codecov/patch 100% of diff hit (target 91.87%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@kstich

This comment has been minimized.

Show comment
Hide comment
@kstich

kstich Aug 4, 2017

Contributor

Thanks again for this work @daum!

Contributor

kstich commented Aug 4, 2017

Thanks again for this work @daum!

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