Flask-SeaSurf is an updated CSRF protection extension for Flask applications. It provides cross-site request forgery prevention via tokens, with support for AJAX requests, cookie-based tokens, and exclusion patterns. Version 2.0.0 is the latest release, with maintenance as needed.
pip install flask-seasurfVerified import paths — ran on the pinned version, not inferred.
Initialize SeaSurf with the Flask app and include {{ csrf_token() }} in forms.
Update templates to render csrf_token() or decorate routes with @csrf.add_csrf_token.
Update any client-side code that reads the cookie, or configure the cookie name via CSRF_COOKIE_NAME.
Set app.secret_key or SECRET_KEY config before initializing SeaSurf.
Include the token in a header like X-CSRFToken with the same value as the cookie or template token.
Change import to 'from flask_seasurf import SeaSurf'.
Add 'app.secret_key = "your-secret-key"' before initializing SeaSurf.
No dependency data recorded yet.