Skip to content

Conversation

@antiguru
Copy link
Member

Summary

  • Adds a new RBAC privilege CREATEDATAFLOW that controls whether a user can execute queries requiring dataflow rendering (slow path) on a cluster
  • Users without this privilege can still execute fast-path queries (constants, index lookups with MFP operations)
  • System clusters (mz_catalog_server, etc.) and superusers bypass the check

Motivation

In multi-tenant or cost-sensitive environments, organizations may want to restrict certain users to only execute queries that can be satisfied by existing indexes, preventing them from triggering expensive dataflow rendering operations.

Changes

  • Add CREATE_DATAFLOW privilege constant ('D', bit 28) to AclMode in mz_acl_item.rs
  • Add CREATEDATAFLOW keyword and privilege parsing in sql-parser
  • Add check_create_dataflow_privilege() function in rbac.rs
  • Insert privilege check in peek_finish() for slow-path queries
  • Add design doc and integration tests

Test plan

  • cargo check passes
  • cargo clippy passes
  • Unit tests pass (cargo test -p mz-repr --lib -- mz_acl)
  • Integration tests pass (bin/sqllogictest -- test/sqllogictest/createdataflow_privilege.slt)

🤖 Generated with Claude Code

@antiguru antiguru requested review from a team as code owners January 15, 2026 09:30
@antiguru antiguru requested a review from SangJunBak January 15, 2026 09:30
@antiguru antiguru marked this pull request as draft January 15, 2026 09:31
@antiguru antiguru force-pushed the disallow_render_dataflow branch 2 times, most recently from f1ea53c to 24f24ae Compare January 15, 2026 12:42
@antiguru antiguru marked this pull request as ready for review January 15, 2026 12:50
@antiguru antiguru requested a review from a team as a code owner January 15, 2026 12:50
@antiguru antiguru force-pushed the disallow_render_dataflow branch from 24f24ae to 4522aa7 Compare January 15, 2026 12:55
@antiguru antiguru requested a review from a team as a code owner January 15, 2026 12:55
@antiguru antiguru force-pushed the disallow_render_dataflow branch from 4522aa7 to 47b9908 Compare January 15, 2026 13:24
antiguru and others added 6 commits January 15, 2026 14:43
Signed-off-by: Moritz Hoffmann <[email protected]>
This adds a new RBAC privilege called CREATEDATAFLOW that controls
whether a user can execute queries requiring dataflow rendering
(slow path) on a cluster. Users without this privilege can still
execute fast-path queries (constants, index lookups with MFP).

Key changes:
- Add CREATE_DATAFLOW privilege constant ('D', bit 28) to AclMode
- Add CREATEDATAFLOW keyword and privilege parsing
- Add check_create_dataflow_privilege() function in rbac.rs
- Insert privilege check in peek_finish() for slow-path queries
- System clusters and superusers bypass the check

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This migration (v80 to v81) ensures backwards compatibility by
granting CREATEDATAFLOW privilege to PUBLIC on all existing clusters
during upgrade. This allows users who could previously run queries
requiring dataflow rendering to continue doing so after the upgrade.

Also updates default privileges so new clusters grant CREATEDATAFLOW
to PUBLIC by default.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Instead of defining a local constant, import and use the existing
AclMode::CREATE_DATAFLOW constant from mz_repr.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: Moritz Hoffmann <[email protected]>
Document the new CREATEDATAFLOW privilege which controls whether users
can execute queries requiring dataflow rendering on clusters:

- Add privilege description explaining when it's needed and use cases
- Update GRANT/REVOKE syntax to include CREATEDATAFLOW for clusters
- Add to default privileges (PUBLIC gets CREATEDATAFLOW on all clusters)
- Add to object privileges table for CLUSTER

The privilege is useful in production to restrict users to fast-path
queries only, preventing accidental high-latency dataflow rendering.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@antiguru antiguru force-pushed the disallow_render_dataflow branch from 47b9908 to 3b54a9a Compare January 15, 2026 13:58
antiguru and others added 2 commits January 15, 2026 16:14
Add expected mz_support=U/other_owner privilege for owner_cluster2
now that default privileges include mz_support USAGE on clusters.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update RBAC documentation test files to include the new CREATEDATAFLOW
privilege in expected test results. The CREATEDATAFLOW privilege is now
granted by default to PUBLIC on all clusters, so SHOW PRIVILEGES and
SHOW DEFAULT PRIVILEGES output includes this privilege.

Files updated:
- rbac-cloud/grant_privileges.yml: Add test_results with all expected rows
- rbac-cloud/grant_roles.yml: Update test_results with CREATEDATAFLOW
- rbac-cloud/show_default_privileges.yml: Add test_results for default privileges
- rbac-cloud/show_privileges.yml: Update test_results with CREATEDATAFLOW
- rbac-sm/grant_privileges.yml: Add test_results and test_replacements override
- rbac-sm/grant_roles.yml: Update test_results with CREATEDATAFLOW
- rbac-sm/show_default_privileges.yml: Add test_results for default privileges
- rbac-sm/show_privileges.yml: Update test_results with CREATEDATAFLOW

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant