title: What is the best way to sanitize inputs with Flask and when using MongoDB?
body: <p>I'm writing my application backend with Python Flask.
  As part of the registration process, I have a form that sends the new user's information to my backend and then adds it to my MongoDB database.</p>
  
  <p>I'm pretty new in this world and never wrote something that has to be secured..</p>
  
  <p>My Python code looks like that:</p>
  
  <pre><code>from flask import Flask, request
  
  app = Flask(__name__)
  
  
  @app.route('/register', methods=['POST'])
  def register():
      username = request.form['username']
      password = request.form['password']
  </code></pre>
  
  <p>Is there a Python library that sanitizes the <code>request.form['username']</code> and <code>request.form['password']</code> field for me? Something that make me safe from XSS and data leaks?</p>
  
  <p>Thanks ahead!</p>