Repository navigation
feat(cubejs): exempt configured partitions from query rewrite row rules - #96
Merged
Merged
Conversation
The platform owner's team (partition fftech.is) must see every partition, but the rule-based row filters scope every team to its own settings.partition. CUBEJS_ROW_RULES_EXEMPT_PARTITIONS (comma-separated) lists partitions whose teams skip Step 1 of queryRewrite. Partition pruning and the field-level access list still apply. The value is deployment config, and teams cannot write settings through Hasura (owners may update only `name`), so a tenant cannot exempt itself. Scope is queryRewrite only, by owner decision; profileTable, smartGenerate and runSql keep applying the rules. Verified on the local stack through /api/v1/dry-run and /api/v1/load as one user who is a member of fftech.is and admin of bonus.is: with the variable set, fftech.is gets no partition filter and reads eight partitions while bonus.is stays filtered to bonus.is; unset, both are filtered as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The platform owner's team (partition
fftech.is) must be able to read every partition. The query rewrite row rules (query_rewrite_rules:semantic_events,data_pointsandentities, eachpartition equals team.settings.partition) scope every team to its own partition.Change
services/cubejs/src/utils/queryRewrite.jsonly (owner decision):CUBEJS_ROW_RULES_EXEMPT_PARTITIONS: a comma-separated list of partitions, trimmed. Read once at module load.teamProperties.partitionis in the list. Partition pruning (step 0b) and the field-level access list (step 2) are unchanged.The value comes from deployment config. Tenants cannot exempt themselves: Hasura lets team owners update only
name, andsettingsis written by provisioning with the admin secret.Not changed:
profileTable,smartGenerateandrunSqlstill apply the rules to every team, fftech.is included.Verification (local stack, real API, one user: fftech.is member + bonus.is admin, no access lists)
/dry-run)partition equals fftech.ispartition equals bonus.is" fftech.is , example.test"(/dry-run)partition equals bonus.is/loadgrouped by partitionbonus.isonly/dry-run)partition equals fftech.ispartition equals bonus.isnpm testin services/cubejs: 703 pass, 2 fail, identical with and without this change. Both failures areruntimeDependencyHardening.test.jschecking installed package versions (thrift 0.20.0 found vs 0.23.0 in the lockfile) and come from my local node_modules. The image installs with Yarn 1 from the lockfile.🤖 Generated with Claude Code