Skip to content

Commit a755439

Browse files
committed
Bind CSRFProtect to Flask app to activate CSRF protection
1 parent 7b88cf0 commit a755439

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ml_rest_api/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import warnings
55
from logging import Logger, getLogger
66
from flask import Flask
7-
from flask_wtf import CSRFProtect # pylint: disable=unused-import # type: ignore
7+
from flask_wtf import CSRFProtect # type: ignore
88
from ml_rest_api.logging_setup import setup_logging
99
from ml_rest_api.settings import get_value
1010
from ml_rest_api.ml_trained_model.wrapper import trained_model_wrapper
@@ -39,6 +39,7 @@ def configure_app(flask_app: Flask) -> None:
3939
def initialize_app(flask_app: Flask) -> None:
4040
"""Initialises the app."""
4141
configure_app(flask_app)
42+
CSRFProtect(flask_app)
4243
with warnings.catch_warnings():
4344
# Temporarily suppressing a warning during registration of the Flask blueprint
4445
warnings.filterwarnings(

0 commit comments

Comments
 (0)