Technical requirements
The requirements for this chapter will, once again, build upon what we used in the previous chapters. Since web security often includes interaction between frontend JavaScript applications and backend Python applications, we will look at some examples that use JavaScript that are widely available in major web browsers. You can find all of the source code for this chapter at https://github.com/PacktPublishing/Python-Web-Development-with-Sanic/tree/main/Chapter07.
In addition, we are going to use three common (and battle-tested) security libraries: cryptography
, bcrypt
, and pyjwt
. If you do not already have them installed in your virtual environment, you can add them now by running the following code:
$ pip install cryptography bcrypt pyjwt
Let's begin with setting up a CORS policy.