Closed rahulk94 closed 2 years ago
Gday @rahulk94, thanks so much for the PR. At first glance the code looks good, but in principle we are very likely not to merge this. Up to this point, we have taken a hard-line stance to not support secureURLToken
in our client-libraries. As Ember, React, Vue are client-libraries, it would require this token to be transmitted to the client. Then, a malicious user could take that token and user your imgix account to render images that they wanted, causing your bill to increase. If your source is a web proxy, they could proxy any image on the internet!
I hope you can see why we cannot support this feature in our client libraries. If there was a way to reliably ensure that this token was only used on the server (e.g. for static sites), then we could support this. But unfortunately this is not possible as far as we are aware. If you are using Ember for SSG, then obviously you are welcome to extend this library (like you have done) and enable this functionality.
As Ember, React, Vue are client-libraries, it would require this token to be transmitted to the client
Huh, sweet yeah that makes sense.
Is there any recommendations on how the secureURLToken
should be used for single page apps? We currently do use server side rendering so our first image loads will use the token server side, but then how would you recommend we go about doing this client side (or is the recommendation "don't" š ) ?
Is there any recommendations on how the
secureURLToken
should be used for single page apps? We currently do use server side rendering so our first image loads will use the token server side, but then how would you recommend we go about doing this client side (or is the recommendation "don't" š ) ?
There is no general recommendation for this since in each case it probably needs to be tailored to your use case. For you I would probably just recommend doing the server side rendering with a modified version of the SDK (that you have already done), and then just don't do anything client side. If you needed to do something client side, you can do something like this that we suggested for a react-imgix user
I'll close this now since I think we've reached agreement about this PR. Happy to re-open or discuss more if necessary
Thanks for the info @frederickfogerty!
Description
This PR adds support for the
secureURLToken
parameter from imgix-core-js by passing this through if it configured in the Ember application's Imgix configuration.This is a non-breaking feature and should be releasable in a minor.
New Feature
feat(<area>): added new way to do this cool thing #issue-number
Steps to Test
ember-cli-imgix
with an Imgix source which requires secure tokens to be provided with images. Without passing throughsecureURLToken
these image requests should be failing and returning a 403 forbidden.secureURLToken
and restart your Ember appI've verified this against our internal application however do not have a token or demo app I could share for this unfortunately.