Skip to main content

Sanitization functions for Flask backend input to prevent XSS, RCE, SQLi and many others

Project description

Flask-Sanitize-Escape 🛡️

PyPI Version Github Build License: MIT Python Version Flask Version

A Flask middleware extension for automatic input sanitization, guarding against common web vulnerabilities like XSS, SQL injection, and other code injection attacks.

Key Features

  • Effortless Integration: Activate the middleware with a single line of code.
  • Automatic Protection: Sanitizes incoming request data without requiring manual intervention in your route handlers.
  • Comprehensive Coverage: Scrubs query parameters, form data, and JSON payloads.
  • Targeted Defense: Neutralizes malicious code through HTML entity encoding and regex-based filtering.
  • Customizable: Easily adapt the sanitization logic to your specific application's needs.

Installation

pip install flask-sanitize-escape

Usage

1. Activate Middleware:

from flask import Flask
from flask_sanitize_escape import SanitizeEscapeExtension

app = Flask(__name__)
app.wsgi_app = SanitizeEscapeExtension.Middleware(app.wsgi_app)

2. Relax! Your application's input data is now automatically sanitized before it reaches your route handlers.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_sanitize_escape-0.0.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

flask_sanitize_escape-0.0.1-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page