-
Notifications
You must be signed in to change notification settings - Fork 276
download_endpoint: Adds support for expiring URLs #708
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
download_endpoint: Adds support for expiring URLs #708
Conversation
|
I suspect the use of AS::Verifier is going to be an issue. We might need to go with |
I'll try it out 🙂 |
|
Yes, Shrine doesn't depend on Active Support, so I want to avoid it if possible, even as an optional dependency. The |
|
Now I rewrote it to use OpenSSL-directly 🙂 |
adam12
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.
Nicely done adapting it for OpenSSL::HMAC. Few comments but overall looks good IMHO. Will leave final sign-off for Janko ofc.
|
@janko could you allow the tests to run? They crash on my side because of |
|
@janko Sorry for a second (and last) ping, do you think there would be bandwidth for handling this PR within November? |
|
Please rebase if willing. Then we can trigger tests to run and maybe get this over the finish line. |
- Adds `expires_in` and `verifier_secret` to `download_endpoint` plugin - This allows calling `attachment.download_url(expires_in: 5 * 60)` to generate a URL that expires in 5 minutes. - The URL is signed and verified with ActiveSupport::MessageVerifier.
Now I have rebased it, please trigger the tests 🙂 |
|
This looks good! Nicely done. I'll merge later today. |
expires_inandsecret_keytodownload_endpointpluginattachment.download_url(expires_in: 5 * 60)to generate a URL including
signatureandexpires_atas query parameters. The timestamp is included in the signature and will only work before that timestamp.