You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2020/09/11 12:07:30 UTC

[incubator-superset] 32/34: Fix: Include RLS filters for cache keys (#10805)

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

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

commit 3d9eab5da0a47d9a48d253f4aa5b002ba25f5bc9
Author: gtg472b <gt...@gmail.com>
AuthorDate: Mon Sep 7 08:49:13 2020 -0600

    Fix: Include RLS filters for cache keys (#10805)
    
    * Fix: Include RLS filters for cache keys
    
    This fix makes sure that RLS filters are searched for templatable jinja content, ensuring cached visualizations aren't shown to the wrong user.
    
    * Fix: Include RLS filters for cache keys
    
    This fix makes sure that RLS filters are searched for templatable jinja content, ensuring cached visualizations aren't shown to the wrong user.
    
    Co-authored-by: Ville Brofeldt <33...@users.noreply.github.com>
    
    Co-authored-by: Ville Brofeldt <33...@users.noreply.github.com>
---
 superset/connectors/sqla/models.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 601a69d..667c9d4 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -1454,6 +1454,10 @@ class SqlaTable(  # pylint: disable=too-many-public-methods,too-many-instance-at
             templatable_statements.append(extras["where"])
         if "having" in extras:
             templatable_statements.append(extras["having"])
+        if config["ENABLE_ROW_LEVEL_SECURITY"] and self.is_rls_supported:
+            templatable_statements += [
+                f.clause for f in security_manager.get_rls_filters(self)
+            ]
         for statement in templatable_statements:
             if ExtraCache.regex.search(statement):
                 return True