Skip to content

Commit 951992c

Browse files
committed
feat(security): add OIDC provider DDL with catalog persistence
Introduces CREATE, ALTER, DROP, and SHOW OIDC PROVIDER statements end-to-end: - SQL parser: OidcClaimMappingClause AST node; new oidc_provider parse module handles CREATE/ALTER/DROP/SHOW OIDC PROVIDER syntax including CLAIM MAPPING WHEN clauses with DEFAULT_DATABASE, ADD DATABASES, and ADD ROLES sub-clauses. - Catalog: _system.oidc_providers redb table storing StoredOidcProvider (issuer, jwks_uri, audience, ordered claim-mapping rules, lsn). put/get/list/delete ops on SystemCatalog. - CatalogEntry: PutOidcProvider and DeleteOidcProvider variants wired through apply, descriptor_stamp, gateway_invalidation (no-op), post-apply sync, async dispatcher, and cluster metadata audit. - DDL handlers: pgwire/ddl/oidc/ (create, alter, drop, show) enforce superuser/ClusterAdmin privilege gates, write the catalog entry, and emit OidcProviderChanged audit events. - DatabaseDescriptor gains idle_session_timeout_secs field (default 0) used later by ALTER DATABASE SET IDLE_TIMEOUT.
1 parent aba9ed5 commit 951992c

26 files changed

Lines changed: 1061 additions & 10 deletions

File tree

nodedb-sql/src/ddl_ast/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ pub use graph_types::{GraphDirection, GraphProperties};
2727
pub use nodedb_types::QuotaSpec;
2828
pub use nodedb_types::{MirrorMode, MirrorStatus};
2929
pub use parse::parse;
30-
pub use statement::{AlterDatabaseOperation, AlterTenantOperation, CloneAsOf, NodedbStatement};
30+
pub use statement::{
31+
AlterDatabaseOperation, AlterTenantOperation, CloneAsOf, NodedbStatement,
32+
OidcClaimMappingClause,
33+
};

nodedb-sql/src/ddl_ast/parse/dispatch.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
55
use super::{
66
alert, backup, change_stream, cluster_admin, collection, conflict_policy, copy_from, copy_to,
7-
custom_type, database, index, maintenance, materialized_view, retention, rls, schedule,
8-
sequence, synonym_group, tenant, trigger, user_auth,
7+
custom_type, database, index, maintenance, materialized_view, oidc_provider, retention, rls,
8+
schedule, sequence, synonym_group, tenant, trigger, user_auth,
99
};
1010
use crate::ddl_ast::graph_parse;
1111
use crate::ddl_ast::statement::NodedbStatement;
@@ -77,6 +77,7 @@ pub fn parse(sql: &str) -> Option<Result<NodedbStatement, SqlError>> {
7777
// COPY TO file-path form — table and query forms.
7878
try_family!(copy_to::try_parse(&upper, trimmed));
7979
try_family!(user_auth::try_parse(&upper, &parts, trimmed));
80+
try_family!(oidc_provider::try_parse(&upper, &parts, trimmed));
8081
try_family!(change_stream::try_parse(&upper, &parts, trimmed));
8182
try_family!(rls::try_parse(&upper, &parts, trimmed));
8283
try_family!(materialized_view::try_parse(&upper, &parts, trimmed));

nodedb-sql/src/ddl_ast/parse/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ mod helpers;
1515
mod index;
1616
mod maintenance;
1717
mod materialized_view;
18+
mod oidc_provider;
1819
mod retention;
1920
mod rls;
2021
mod schedule;

0 commit comments

Comments
 (0)