-
Notifications
You must be signed in to change notification settings - Fork 451
[Storage] Signed URLs v4 #1742
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
[Storage] Signed URLs v4 #1742
Conversation
frankyn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay, here's a first pass review.
Please update signed-url-v4-testdata.json as it was recently updated.
frankyn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation LGTM, pending tests passing with conformance tests. I added small nits in this request for changes.
Thanks @jdpedrie.
Storage/src/SigningHelper.php
Outdated
| //@codeCoverageIgnoreStart | ||
| if ($version === null && self::DEFAULT_URL_SIGNING_VERSION === 'v2') { | ||
| // raise a little notice to poke users towards v4. | ||
| @trigger_error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this error out an application or only log a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will only log a notice.
frankyn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending failed tests and auth PR the implementation LGTM.
Storage/src/Bucket.php
Outdated
| * @type array $queryParams Additional query parameters to be included | ||
| * as part of the signed URL query string. For allowed values, | ||
| * see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query). | ||
| * @type string $version One of "v2" or "v4". In the future, "v4" will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove mention of "v2 -> v4 as default" here as well.
frankyn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move forward with language reviews if necessary. LGTM, thank you for your patience @jdpedrie
Codecov Report
@@ Coverage Diff @@
## master #1742 +/- ##
=========================================
Coverage ? 91.58%
Complexity ? 4403
=========================================
Files ? 305
Lines ? 13089
Branches ? 0
=========================================
Hits ? 11987
Misses ? 1102
Partials ? 0
Continue to review full report at Codecov.
|
dwsupplee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still finishing up, just had some thoughts that seemed worthwhile to get out in case it is anything we could continue on in parallel.
Storage/src/SigningHelper.php
Outdated
| } | ||
|
|
||
| $options['keyFile'] = json_decode(file_get_contents($keyFilePath), true); | ||
| if (json_last_error() !== JSON_ERROR_NONE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use the JsonTrait here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. Please note that this required making the methods in JsonTrait static.
| * | ||
| * @return SigningHelper | ||
| */ | ||
| public static function getHelper() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need an instance at all? It looks like we should be able to make v2sign and v4sign static. Just being able to call SigngingHelper::v2Sign seems friendlier than having to work with this getHelper method.
dwsupplee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work abstracting this out 👍
This is still a work in progress, but it's progressed far enough to start getting some additional eyes on it.
The signing logic is going to move to the Auth library. A change for that will be forthcoming.
cc @frankyn
Closes #1672.