Reputation: 3338
A Dropbox browser client with application API key and secret stored in its source code is a bad idea as anyone could impersonate the application using them.
I think that the application stored on the client can never be completely secure, but I still would like to hear from developers more experienced than me.
Thank you in advance for your help
Upvotes: 1
Views: 417
Reputation: 60143
Caveat: I'm not a security expert.
Using the encoder might discourage a casual "attacker" from picking up your app key and secret, but it doesn't provide any true security. Here's a line of code using the JS library that converts an encoded key back into the unencoded key/secret pair:
Dropbox.Util.atob(Dropbox.Util.encodeKey(encodedSecret).split('|')[1]).split('?')
That said, the security risk here is that someone else uses your app key and secret, which is arguably not the end of the world. Pretty much all client apps that use OAuth (in the browser, on the desktop, and on mobile platforms) suffer from this problem. For example, here's one article discussing Twitter's leaked consumer key/secret: https://news.ycombinator.com/item?id=5337099.
I think the most likely consequence of exposing your app key and secret is that someone will copy/paste your code and use your credentials. This would be misleading to users (who will see the name of your app when they authorize via OAuth), and if another app takes your key and uses it in a malicious app, your legitimate app might end up being collateral damage.
Upvotes: 1