Where to store sensitive data in public rails app?

TLDR: Use environment variables! I think @Bryce’s comment offers an answer, which I’ll just flush out. It seems one approach Heroku recommends is to use environment variables to store sensitive information (API key strings, database passwords). So survey your code and see in which you have sensitive data. Then create environment variables (in your .bashrc … Read more

How to store a secret API key in an application’s binary?

There is no real perfect solution. No matter what you do, someone dedicated to it will be able to steal it. Even Twitter for iPhone/iPad/Android/mac/etc. has a secret key in there, they’ve likely just obscured it somehow. For example, you could break it up into different files or strings, etc. Note: Using a hex editor … Read more

Is there an accepted way to use API keys for authentication in Flask? [closed]

For authentication keys, create a random value and store that value in a database. random() provides insufficient entropy for things like this, so use os.urandom(). The link you posted to has a very good example of how to handle things with a decorator function. In the decorator function, check the appkey value is set in … Read more