Simple user session protection
  • Python 85.9%
  • HTML 14.1%
Find a file
2026-05-14 23:19:31 +01:00
.github/workflows tox configuration 2026-05-14 23:19:31 +01:00
docs documentation fixes 2017-07-01 23:57:00 -07:00
example Bump werkzeug from 2.0.2 to 2.2.3 in /example (#12) #nolog 2023-02-16 10:05:57 +00:00
src/flask_paranoid project restructure and test fixes 2022-04-02 17:14:30 +01:00
tests project restructure and test fixes 2022-04-02 17:14:30 +01:00
.gitignore add zizmor to ci 2026-05-13 20:05:54 +01:00
.travis.yml tox and travis build setup 2017-07-01 00:02:44 -07:00
CHANGES.md Release 0.3.0 2022-04-02 17:26:49 +01:00
LICENSE initial commit 2017-06-29 23:14:47 -07:00
MANIFEST.in Migrate Python package metadata to pyproject.toml 2023-10-15 14:23:40 +01:00
pyproject.toml add zizmor to ci 2026-05-13 20:05:54 +01:00
README.md add change log 2022-04-02 17:25:19 +01:00
setup.cfg Version 0.3.1.dev0 2022-04-02 17:27:10 +01:00
setup.py project restructure and test fixes 2022-04-02 17:14:30 +01:00
tox.ini tox configuration 2026-05-14 23:19:31 +01:00

flask-paranoid

Build status codecov

Simple user session protection.

Quick Start

Here is a simple application that uses Flask-Paranoid to protect the user session:

from flask import Flask
from flask_paranoid import Paranoid

app = Flask(__name__)
app.config['SECRET_KEY'] = 'top-secret!'

paranoid = Paranoid(app)
paranoid.redirect_view = '/'

@app.route('/')
def index():
    return render_template('index.html')

When a client connects to this application, a "paranoid" token will be generated according to the IP address and user agent. In all subsequent requests, the token will be recalculated and checked against the one computed for the first request. If the session cookie is stolen and the attacker tries to use it from another location, the generated token will be different, and in that case the extension will clear the session and block the request.

Resources