You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/12 08:41:52 UTC

[GitHub] [airflow] ephraimbuddy commented on a change in pull request #15295: Prevent creating flask sessions on REST API requests

ephraimbuddy commented on a change in pull request #15295:
URL: https://github.com/apache/airflow/pull/15295#discussion_r611436504



##########
File path: airflow/www/security.py
##########
@@ -44,6 +46,24 @@
 }
 
 
+class DefaultSessionInterface(SecureCookieSessionInterface):
+    """
+    Default cookie session interface.
+    This prevents creating flask sessions on REST API requests.
+    """
+
+    def save_session(self, *args, **kwargs):
+        """Prevent creating session from REST API requests."""
+        if g.get('login_from_api'):

Review comment:
       > Maybe we should do check here `if request.url.startswith ("/api/")`? This will then simplify the code a bit. And it will also prevent discovery endpoints(non-login-required) e.g. `/healtth`, `/version` from creating sessions.
   
   And I think using this will also get rid of 'login_from_api'. Thanks! testing




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org