Skip to content

Commit 881236b

Browse files
ilija-lazoroskishreyamalviya
authored andcommitted
Island: Disable CSRF and set auth expiration time to 30 minutes
Issue: #2157 PR: #3075
1 parent cb41869 commit 881236b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

monkey/monkey_island/cc/app.py

+4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
from monkey_island.cc.setup.mongo.mongo_setup import MONGO_DB_HOST, MONGO_DB_NAME, MONGO_DB_PORT
5555

5656
HOME_FILE = "index.html"
57+
AUTH_EXPIRATION_TIME = 30 * 60 # 30 minutes authentication token expiration time
5758

5859

5960
def serve_static_file(static_path):
@@ -94,7 +95,10 @@ def setup_authentication(app, data_dir):
9495
app.config["SECURITY_USERNAME_REQUIRED"] = True
9596
app.config["SECURITY_REGISTERABLE"] = True
9697
app.config["SECURITY_SEND_REGISTER_EMAIL"] = False
98+
99+
app.config["SECURITY_TOKEN_MAX_AGE"] = AUTH_EXPIRATION_TIME
97100
# Ignore CSRF, because it's irrelevant for javascript applications
101+
app.config["WTF_CSRF_ENABLED"] = False
98102
app.config["WTF_CSRF_CHECK_DEFAULT"] = False
99103
app.config["SECURITY_CSRF_IGNORE_UNAUTH_ENDPOINTS"] = True
100104
# Forbid sending authentication token in URL parameters

0 commit comments

Comments
 (0)