-
Notifications
You must be signed in to change notification settings - Fork 373
Open
Description
Similar to the EXPLORER_SQL_BLACKLIST, I would love a feature that would enable blocking queries to specific tables (e.g. auth_user, authtoken_token, django_session, etc.). I know the correct way to do this is to only grant select access to the correct tables for the read only database account being used for the SQL Explorer connection. But as with EXPLORER_SQL_BLACKLIST, in some use cases, setting those permissions may not be available.
Sample logic:
def passes_table_blacklist(sql: str) -> Tuple[bool, Iterable[str]]:
blocked_tables = getattr(settings, 'EXPLORER_TABLE_BLACKLIST', [])
failed_tables = [table.upper() for table in blocked_tables if table.upper() in sql.upper()]
return bool(failed_tables), failed_tables
Compare to passes_blacklist.
Metadata
Metadata
Assignees
Labels
No labels