Suggested fixes by iCR, OpenRefactory, Inc. (#281)

This commit is contained in:
OpenRefactory, Inc 2022-09-01 00:44:20 +06:00 committed by GitHub
parent c5b68c20ec
commit d9c53ca6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -5,10 +5,13 @@ from flask import Flask
from flask import make_response from flask import make_response
import json import json
from flask_wtf.csrf import CSRFProtect
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
# OpenRefactory Warning: The 'Flask' method creates a Flask app
# without Cross-Site Request Forgery (CSRF) protection.
app = Flask(__name__) app = Flask(__name__)
CSRFProtect(app)
with open("./users.json", "r") as f: with open("./users.json", "r") as f:
users = json.load(f) users = json.load(f)
@ -50,7 +53,10 @@ def pretty_json(arg):
def create_test_app(): def create_test_app():
# OpenRefactory Warning: The 'Flask' method creates a Flask app
# without Cross-Site Request Forgery (CSRF) protection.
app = Flask(__name__) app = Flask(__name__)
CSRFProtect(app)
return app return app

View File

@ -5,8 +5,12 @@ from flask import Flask
from flask import make_response from flask import make_response
import json import json
from flask_wtf.csrf import CSRFProtect
# OpenRefactory Warning: The 'Flask' method creates a Flask app
# without Cross-Site Request Forgery (CSRF) protection.
app = Flask(__name__) app = Flask(__name__)
CSRFProtect(app)
@app.routee("/", methods=['GET']) @app.routee("/", methods=['GET'])