Skip to content

Security + multi-tenancy #816

Closed
Closed

Description

@derekperkins

The power of Mosaic is the embrace of SQL as the core language, allowing it to issue arbitrary SQL commands to build tables, and through DuckDB, interact with other databases, files, and apis. If I'm running DuckDB on the server, what is the path for client authorization? I know that the requests themselves can authenticate the user, but how can I make sure that the sql queries themselves aren't accessing data that they shouldn't be? DuckDB doesn't have user permissions, so I can't lean on it.

I'm thinking that the most viable option is to use DuckDB json_serialize_sql, and recurse through it to make sure that only an allowlist of schemas/tables/commands are included, and reject anything that doesn't match. Setting preagg.schema in mosaic to something like the tenant_id, I could match the user from the request to the duckdb schema, preventing any cross-tenant arbitrary queries.

Does that sound like a viable solution? Are there considerations aside from just SQL that I'm missing?

Activity

  1. locked and limited conversation to collaborators on Jun 29, 2025
  2. converted this issue into a discussion #817 on Jun 29, 2025
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