From the course: Secure Coding in Python

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Flask secrets

Flask secrets - Python Tutorial

From the course: Secure Coding in Python

Start my 1-month free trial

Flask secrets

- Flask is very flexible. You can see the flexibility in simple things like configuring your application. For comparison, when we generated our Django application, right out of the box, we got a settings.py file with a lot of very sensible defaults. With flask, there's none of that. In exchange for flexibility, you get a lot less out of the box and it's up for you as a developer to make sensible security choices. A good example of that is the secret key. In our GNU application, we saw a secret key generated for us, and a pretty good one. All that was left for us is to keep it out of source code. With Flash, it's up to you to generate that secret key and generating a good secret key is crucial for preserving the dignity of your session content. So the two things to keep in mind is, just like in Django, we have to keep that secret key out of source code and source control, and the secret key must be pretty random. How do we…

Contents