Requests from another site and a path that climbs out of its folder are stopped at the service's gate, while a request from its own site gets 200 OK.

Web Security with Python

No reviews yet

Take a working web service and make it hard to abuse. You will store passwords so a leak does not reveal them, keep sessions and signed tokens that cannot be forged, validate what a request may ask for, stop cross-site requests, answer CORS correctly because you know what a browser checks, and keep secret keys out of your source. You run every attack against your own server and prove every fix with a test.
You need HTTP with Python first: a JSON API written as a handle(request, state) function, cookies and a server-side session, Basic and bearer authentication, and tests that call the handler directly. Python Fundamentals II helps but is not required: you read a few classes and never write one.
Every attack targets your own code, on the loopback address or in memory; the sandbox has no internet and no browser. The browser rules behind CSRF and CORS are a small model that you write yourself. One project, the reading list from HTTP with Python, is hardened up to the capstone.

  • 12

    chapters

  • 64

    lessons

  • 33

    practice exercises

  • 13

    projects

Certificate when you finish Available inEnglishNederlandsDeutsch

Lessons are arranged in a recommended order, but you can open any lesson.

Chapter 1

What Can Go Wrong

Chapter 2

Hashes, MACs, and Random Values

Chapter 3

Store Passwords Safely

Chapter 4

Sessions That Hold

Chapter 5

Signed Tokens and Secret Keys

Chapter 6

Who May Do What, and How Often

Chapter 7

Input That Becomes Code

Chapter 8

Origins and Cross-Site Requests

Chapter 9

CORS

Chapter 10

HTTPS, Certificates, and Security Headers

Chapter 11

Capstone: Harden the Reading List

Chapter 12

The Map and Where to Go Next