Skip to main content

Superset in governed mode (Enterprise)

Ranger policies match the user name of each query. A BI tool that connects with one account of its own would run every dashboard under that account, so all its users would see the same data. In a governed installation Superset therefore connects to Trino with impersonation: it signs in to Trino as its own account, ilum-superset, and runs each query as the user who is signed in to Superset. Trino asks Ranger whether the account may act for that user, then applies the user's table, masking and row-filter policies and names the user in the audit record.

How it works​

  • With values-governed.yaml and superset.enabled: true, the chart generates a password for the account ilum-superset, adds the account to Trino's password file and keeps the password, with Trino's CA, in the Secret ilum-trino-superset (see Trino authentication).
  • The Superset init Job writes the connection Ilum-SQL-Trino: trino://ilum-superset@ilum-trino:8443/ilum-delta over HTTPS, trusting Trino's CA, with Impersonate logged in user on (the impersonate_user setting of a Superset 6.0 database connection). Superset then sends the signed-in user's name as the Trino user of each query.
  • The ilum-ranger bootstrap lets ilum-superset act as any Trino user (trinouser *, impersonate), as it does for the SQL engine's technical account. A Superset user cannot switch to another user from SQL Lab: for SET SESSION AUTHORIZATION, Trino checks whether the signed-in user, not the account, may act as the other user.
  • Chart results are cached per user (Per user caching on the connection). Without it, Superset serves a result cached for one user to the next user who opens the same chart.
  • A NetworkPolicy admits Superset's web and worker pods to Trino's HTTPS port.
  • The static connections of the chart (Spark SQL through ilum-sql, Trino on port 8080) are not imported, because both engines require a password in governed mode, and no DuckDB connection with storage keys is created (see Governed mode).

The connection is read-only by default: SQL Lab refuses DML, CREATE TABLE AS and CREATE VIEW AS on it. An administrator may allow them in the connection settings; Ranger still decides what each user may change.

Enabling​

Turn Superset on together with the governed preset:

helm upgrade --install ilum ilum/ilum -f my-values.yaml -f values-governed.yaml --set superset.enabled=true

The init Job runs after every install and upgrade and writes the connection's address, password and CA again. On an installation that already had Superset, it moves the existing connection Ilum-SQL-Trino to the account and to HTTPS, so charts and datasets built on it keep their database and run as the signed-in user from then on. A chart whose user may not read its table now fails, as the same query fails in any other Trino client.

values-governed.yaml sets superset.envFromSecrets to the Secret ilum-trino-superset and replaces the list of static connections (superset.extraConfigs) with an empty one. Helm replaces lists as a whole: carry entries of your own over into a values file applied after it. The render fails when the Secret and the list disagree, for example when global.trinoAuth.superset.enabled is turned off but superset.envFromSecrets still names the Secret; set superset.envFromSecrets: [] in that case.

User names​

Ranger knows users by the names that usersync brings from the directory, and Ilum signs users in under the same names. A Superset user name must be that name, or Ranger evaluates the policies of another user, or of none. Superset's own user database names users freely, so a Superset administrator could create a user named like any Ilum user and query Trino as that user. Sign users in to Superset through Ilum or through the directory instead.

In governed mode (global.security.governedMode) the render fails while Superset through Trino is on and Superset uses its own user database. The chart reads superset.configOverrides and accepts the installation when one of them sets AUTH_TYPE to AUTH_OID (Ilum's own override, active with global.security.hydra.enabled), AUTH_OAUTH or AUTH_LDAP. Any other setting, including none, is the local user database.

Local Superset users

global.trinoAuth.superset.allowLocalUsers: true turns the check off. Superset administrators can then create a user with the name of any Ilum user and query Trino with that user's access, including data that Ranger masks for them. Use it only while every Superset administrator may see all governed data.

Sign-in through Ilum​

With Ilum's OAuth2 provider on (global.security.hydra.enabled, see OAuth2 provider), Superset signs users in through Ilum. Each Superset user is named after the Ilum user, and the Superset roles follow the user's Ilum permissions. This is the recommended setup.

Sign-in through LDAP​

Superset can also sign users in against the directory that Ilum and Ranger usersync read. Add the settings to Superset's configuration:

superset:
extraSecretEnv:
SUPERSET_LDAP_BIND_PASSWORD: "<bind password>"
configOverrides:
ilum_ldap: |
from flask_appbuilder.security.manager import AUTH_LDAP
AUTH_TYPE = AUTH_LDAP
AUTH_LDAP_SERVER = "ldaps://ad.example.com:636"
AUTH_LDAP_SEARCH = "OU=Users,DC=example,DC=com"
AUTH_LDAP_UID_FIELD = "sAMAccountName"
AUTH_LDAP_BIND_USER = "CN=svc-superset,OU=Service,DC=example,DC=com"
AUTH_LDAP_BIND_PASSWORD = os.environ["SUPERSET_LDAP_BIND_PASSWORD"]
AUTH_USER_REGISTRATION = True
AUTH_USER_REGISTRATION_ROLE = "Gamma"

AUTH_LDAP_UID_FIELD must be the attribute that Ilum and usersync take as the user name (uid in OpenLDAP, sAMAccountName in Active Directory). For more information about LDAP sign-in refer to the Flask-AppBuilder security documentation.

Superset administrators

Superset's Admin role can edit the connection, including its account and its settings, and so act as any Trino user. Give it only to people who may see all governed data. With sign-in through Ilum or LDAP, the bootstrap administrator (superset.extraSecretEnv.ADMIN_USERNAME) can no longer sign in with its password.

Reports, alerts and thumbnails​

Scheduled reports and alerts run in Superset's worker, without a signed-in user. Superset runs them as the user that its executor settings name: the owner of the report by default (ALERT_REPORTS_EXECUTORS), and the current user for thumbnails (THUMBNAIL_EXECUTORS). Superset 5.0 renamed these settings; earlier versions call them ALERT_REPORTS_EXECUTE_AS and THUMBNAIL_EXECUTE_AS. The recipients of a report receive what its owner may see.

Audit​

Trino's Ranger plugin names the Superset user in each audit record (reqUser), as it does for queries from the SQL editor. The records go to the Trino coordinator's log (logger xaaudit) and, with log aggregation on, to Loki (see Audit).

Configuration​

NameDescriptionDefault
global.trinoAuth.superset.enabledWith Trino authentication, Trino and Superset on: Superset gets its Trino account and connectiontrue
global.trinoAuth.superset.userTrino account of Superset; must differ from global.trinoAuth.technicalUserilum-superset
global.trinoAuth.superset.secretSecret with the account's password (ILUM_TRINO_SUPERSET_PASSWORD) and Trino's CA (ILUM_TRINO_CA)ilum-trino-superset
global.trinoAuth.superset.databaseName of the connection in SupersetIlum-SQL-Trino
global.trinoAuth.superset.allowLocalUsersAccept Superset's own user database in governed mode; see the warning in User namesfalse
global.trinoAuth.superset.catalogCatalog in the connection's URI; other catalogs are reached by their full namesilum-delta
superset.envFromSecretsMust name global.trinoAuth.superset.secret while the account is on[ilum-trino-superset] in values-governed.yaml

The ilum-ranger bootstrap follows global.trinoAuth.superset.enabled alone, because it cannot see superset.enabled: with Superset off, the account keeps its impersonate grant but has no line in the password file, so it cannot sign in. Turn the switch off where Superset is not used.

The password is generated once and kept across upgrades. To change it, delete the Secret ilum-trino-superset and run helm upgrade: the chart generates a new password and password-file line, and the init Job writes the new password into the connection. With global.trinoAuth.createSecrets: false, create the Secret with both keys yourself and add the account's line to password.db (see Users in the password file).

Limits​

  • Superset reaches governed data through Trino only. The Spark SQL engine requires each user's own credentials, and Superset does not pass them.
  • SQL Lab runs queries in the web pod (allow_run_async: false).
  • superset.envFromSecrets passes the account's password to every Superset pod, although only the init Job uses it. Those pods already hold Superset's secret key, which decrypts the passwords that Superset stores.
  • Do not set the connection's metadata cache timeouts: Superset caches table lists per connection, not per user.
  • The account's name must not exist in the directory when Trino also signs users in through LDAP: a directory user of that name could sign in as the account.