
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
flask-sanitize-escape
Advanced tools
Sanitization functions for Flask backend input to prevent XSS, RCE, SQLi and many others
A Flask middleware extension for automatic input sanitization, guarding against common web vulnerabilities like XSS, SQL injection, and other code injection attacks.
pip install flask-sanitize-escape
from flask import Flask
from flask_sanitize_escape import SanitizeEscapeExtension
app = Flask(__name__)
# Initialize the extension with options
sanitize_extension = SanitizeEscapeExtension(
app, sanitize_quotes=True, custom_characters=["$", "#", "%"]
)
sanitize_extension.init_app(app) # Register the middleware
NOTE
It is suggested to use sanitize_quotes=True
@app.route('/submit', methods=['POST'])
def submit_data():
data = g.sanitized_json # accessing JSON from request.get_json()
data = g.sanitized_args # accessing arguments from request.args
data = g.sanitized_form # accessing values from request.form
# Safely process the sanitized data...
Stay tune for upcoming version
We welcome contributions! Feel free to open issues for bugs or feature requests, or submit pull requests with improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Sanitization functions for Flask backend input to prevent XSS, RCE, SQLi and many others
We found that flask-sanitize-escape demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.