
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
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.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.