Hi all,

While going through the BI repo's PII handling, I noticed the docs still
described client_hash as unsalted MD5, though platform.sql now uses keyed
HMAC-SHA256. I've opened a small docs fix for that:
https://github.com/apache/fineract-business-intelligence/pull/131

That led me to the dashboard row scoping, which I'd like to work on next:
enforcing it inside Postgres, as defence in depth on top of the Superset
datasets.

Today the scoping lives in the 6 superset/datasets/*.sql files, so it only
applies to queries that go through those datasets. analytics_reader itself
can read the marts unfiltered, which SECURITY.md §9 already notes for SQL
Lab.

Rough idea:
- Postgres RLS policies (ENABLE + FORCE) on the analytics marts, reusing
meta.user_scope / meta.is_admin_user, applied from a dbt macro so rebuilds
and full refreshes keep them
- Carry the Superset user into the session in a way a SQL Lab user can't
overwrite. A plain session variable won't work, since set_config isn't
blocked in SQL Lab. Options I see: per-user Postgres roles with Superset
impersonation, or a signed user token checked by a SECURITY DEFINER function
- Turn on CACHE_QUERY_BY_USER (or keep the username in the cache key), so
cached chart data isn't shared across users once the datasets stop calling
current_username()
- Run the existing test_rls_isolation.py suite against the policies, plus
tests that raw SQL as analytics_reader is filtered too

Questions before I start:
1. Would you accept this, given SQL Lab restriction is currently listed in
SECURITY.md §9 as not provided?
2. Any preference between impersonation and a signed token, or would you
rather rely on Superset's own RLS filters (RLS_IN_SQLLAB is still marked
testing)?

Thanks,
Abhishek Chaudhary

Reply via email to