You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by dp...@apache.org on 2020/07/29 08:32:41 UTC

[incubator-superset] branch master updated: fix(log): log endpoint authentication (#10435)

This is an automated email from the ASF dual-hosted git repository.

dpgaspar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 0aad9c6  fix(log): log endpoint authentication (#10435)
0aad9c6 is described below

commit 0aad9c6f4820ba3e917ca49a154a03fa74c4c11c
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Wed Jul 29 09:32:10 2020 +0100

    fix(log): log endpoint authentication (#10435)
    
    * fix(log): log crashes if expired or not authenticated
    
    * add auth to log endpoint
---
 superset/utils/log.py  | 2 +-
 superset/views/core.py | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/superset/utils/log.py b/superset/utils/log.py
index 1b6e1b6..5b11d45 100644
--- a/superset/utils/log.py
+++ b/superset/utils/log.py
@@ -42,7 +42,7 @@ class AbstractEventLogger(ABC):
         @functools.wraps(f)
         def wrapper(*args: Any, **kwargs: Any) -> Any:
             user_id = None
-            if g.user:
+            if hasattr(g, "user") and g.user:
                 user_id = g.user.get_id()
             payload = request.form.to_dict() or {}
 
diff --git a/superset/views/core.py b/superset/views/core.py
index fdf9892..e4f6be3 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1690,6 +1690,7 @@ class Superset(BaseSupersetView):  # pylint: disable=too-many-public-methods
 
     @api
     @event_logger.log_this
+    @has_access
     @expose("/log/", methods=["POST"])
     def log(self) -> FlaskResponse:  # pylint: disable=no-self-use
         return Response(status=200)