Skip to content

Feature request: Block access to certain tables #697

Description

@cshaley

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions