mirror of
https://github.com/github/codeql.git
synced 2025-12-22 03:36:30 +01:00
29 lines
632 B
Python
29 lines
632 B
Python
from flask import Flask, request
|
|
from pymongo import MongoClient
|
|
from mongosanitizer.sanitizer import sanitize
|
|
import json
|
|
|
|
app = Flask(__name__)
|
|
client = MongoClient()
|
|
|
|
|
|
@app.route("/bad")
|
|
def bad():
|
|
unsafe_search = request.args['search']
|
|
json_search = json.loads(unsafe_search)
|
|
|
|
return client.db.collection.find_one({'data': json_search})
|
|
|
|
|
|
@app.route("/good")
|
|
def good():
|
|
unsafe_search = request.args['search']
|
|
json_search = json.loads(unsafe_search)
|
|
safe_search = sanitize(json_search)
|
|
|
|
return client.db.collection.find_one({'data': safe_search})
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run(debug=True)
|