Repository navigation
Conversation
CREATE COLLECTION, CREATE TABLE and CREATE TIMESERIES now check the Create permission on the target database before any other work. A caller without it gets SQLSTATE 42501. Add a shared helper module with a create check and an owner-or-admin check.
CREATE VECTOR, SEARCH, FULLTEXT, SPARSE and SPATIAL INDEX now check the Create permission on the target database before they read or change anything. A caller without it gets SQLSTATE 42501.
CREATE SORTED INDEX now checks the Create permission on the target database before it parses the collection or builds the index. A caller without it gets SQLSTATE 42501.
ALTER COLLECTION and ALTER TABLE now run one owner-or-admin check before every sub-command. The caller must own the collection, hold tenant_admin, or be a superuser. A refusal is SQLSTATE 42501.
ALTER TIMESERIES now checks that the caller owns the collection, holds tenant_admin, or is a superuser. A refusal is SQLSTATE 42501.
ALTER COLLECTION SET VECTOR METADATA now checks that the caller owns the collection, holds tenant_admin, or is a superuser. A refusal is SQLSTATE 42501.
ADD CONSTRAINT, DROP CONSTRAINT, ADD PERIOD LOCK and DROP PERIOD LOCK now check that the caller owns the collection, holds tenant_admin, or is a superuser. A refusal is SQLSTATE 42501. Typeguard statements are unchanged.
COMPACT, REINDEX, CREATE CHECKPOINT, DROP CHECKPOINT and COMPACT HISTORY now check that the caller owns the collection, holds tenant_admin, or is a superuser. A refusal is SQLSTATE 42501.
CONVERT COLLECTION now checks that the caller owns the collection, holds tenant_admin, or is a superuser. A refusal is SQLSTATE 42501.
CREATE MATERIALIZED VIEW on the periodic path needs ownership of the source collection or an admin role. DROP MATERIALIZED VIEW needs the view owner, the owner of the same-named collection, or an admin role. A refusal is SQLSTATE 42501.
The [auth] key ddl_authorization takes open, tenant_admin, permission, owner or mix. The default is open, which adds no check. The node reads the value once at startup into SharedState. Every node of a cluster must carry the same value. The RBAC docs list what each value requires.
authorize_ddl reads the ddl_authorization mode and applies one table for every covered statement. The mode open and a superuser pass at once. The create, change, drop and tenant-wide helpers call it. A materialized view create now follows the create action and a view drop the drop action. DROP COLLECTION and CREATE INDEX keep their own checks in every mode.
Sequence create, alter and drop, ALTER SCHEDULE, the rate gate functions and permission tree set and drop call require_tenant_wide. Under the default mode open they pass as before. The other modes need TenantAdmin, or the Admin permission under permission.
…L owner-or-admin check CREATE/ALTER/DROP TYPEGUARD and ALTER VECTOR INDEX SEAL/COMPACT/SET carried no permission check at all, under every ddl_authorization mode including the strictest. Any tenant member, not only the collection's owner, could add, replace or drop schema-validation guards on someone else's collection, or force-compact, seal, or retune another owner's vector index (m, ef_construction, pq_m, ivf_cells, ivf_nprobe), degrading its search quality or availability. Both now call the same require_owner_or_admin check ADD/DROP CONSTRAINT and COMPACT/REINDEX already carry, before any read or mutation. A caller who is not the collection's owner, tenant_admin, or superuser gets SQLSTATE 42501. Adds the ddl_authorization harness knob (TestServer::start_with_ddl_authorization) needed to exercise any of this PR's permission checks under a non-open mode -- none of the 14 commits so far had one.
This branch has not been deployed
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.
Applies the approved DDL policy mix: Create permission for creation, owner-or-admin for existing objects, tenant_admin for tenant-wide statements. Introduces the
ddl_authorizationnode setting (defaultopen, no behavior change) and routes every covered statement through one sharedauthorize_ddlcheck.ddl: require the Create permission to create a collection(a20ce808c)CREATE COLLECTION,CREATE TABLEandCREATE TIMESERIESnow check the Create permission on the target database before any other work. A caller without it gets SQLSTATE42501. Adds a shared helper module with a create check and an owner-or-admin check.ddl: require the Create permission to create a search index(80990c79c)CREATE VECTOR, SEARCH, FULLTEXT, SPARSE and SPATIAL INDEXnow check the Create permission on the target database before they read or change anything. A caller without it gets SQLSTATE42501.ddl: require the Create permission to create a sorted index(a232e9016)CREATE SORTED INDEXnow checks the Create permission on the target database before it parses the collection or builds the index. A caller without it gets SQLSTATE42501.ddl: require ownership or admin to alter a collection(abfd1ab5a)ALTER COLLECTIONandALTER TABLEnow run one owner-or-admin check before every sub-command. The caller must own the collection, holdtenant_admin, or be a superuser. A refusal is SQLSTATE42501.ddl: require ownership or admin to alter a timeseries collection(503888809)ALTER TIMESERIESnow checks that the caller owns the collection, holdstenant_admin, or is a superuser. A refusal is SQLSTATE42501.ddl: require ownership or admin to set vector metadata(4fc15b5bf)ALTER COLLECTION SET VECTOR METADATAnow checks that the caller owns the collection, holdstenant_admin, or is a superuser. A refusal is SQLSTATE42501.ddl: require ownership or admin to change constraints and period locks(a6e5e84ca)ADD CONSTRAINT,DROP CONSTRAINT,ADD PERIOD LOCKandDROP PERIOD LOCKnow check that the caller owns the collection, holdstenant_admin, or is a superuser. A refusal is SQLSTATE42501. Typeguard statements are unchanged.ddl: require ownership or admin for maintenance and history statements(0585b7fbb)COMPACT,REINDEX,CREATE CHECKPOINT,DROP CHECKPOINTandCOMPACT HISTORYnow check that the caller owns the collection, holdstenant_admin, or is a superuser. A refusal is SQLSTATE42501.ddl: require ownership or admin to convert a collection(3cc357a10)CONVERT COLLECTIONnow checks that the caller owns the collection, holdstenant_admin, or is a superuser. A refusal is SQLSTATE42501.ddl: require ownership or admin for materialized view create and drop(6da720192)CREATE MATERIALIZED VIEWon the periodic path needs ownership of the source collection or an admin role.DROP MATERIALIZED VIEWneeds the view owner, the owner of the same-named collection, or an admin role. A refusal is SQLSTATE42501.ddl: format the permission helper module(a82e9f83e)Formatting only, no behavior change.
config: add the ddl_authorization node setting(7215f833f)The
[auth]keyddl_authorizationtakesopen,tenant_admin,permission,ownerormix. The default isopen, which adds no check. The node reads the value once at startup intoSharedState. Every node of a cluster must carry the same value. The RBAC docs list what each value requires.ddl: route schema DDL checks through authorize_ddl(25caab47d)authorize_ddlreads theddl_authorizationmode and applies one table for every covered statement. The modeopenand a superuser pass at once. The create, change, drop and tenant-wide helpers call it. A materialized view create now follows the create action and a view drop the drop action.DROP COLLECTIONandCREATE INDEXkeep their own checks in every mode.ddl: apply the DDL authorization mode to tenant-wide statements(159ec1e28)Sequence create, alter and drop,
ALTER SCHEDULE, the rate gate functions and permission tree set and drop callrequire_tenant_wide. Under the default modeopenthey pass as before. The other modes needTenantAdmin, or theAdminpermission underpermission.