Repository navigation
Conversation
Provide an asynchronous SecretsStore extension point with an atomic in-memory default, CREATE/DROP SECRET statements, provider access, and receiver-local named credential references. Redact secret definitions in diagnostics and reject serialization of credential-bearing local DDL. Include provider examples, lifecycle and canary regressions, and SQL/API migration documentation.
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.
Which issue does this PR close?
Closes #25662.
Rationale for this change
External catalogs and table providers need to reuse credentials and allow applications to supply them outside SQL. Passing each credential through connection options exposes values to statement and plan formatting and leaves each integration to manage its own store.
What changes are included in this PR?
SecretsStore, an atomic in-memory default, and session/builder access for providers and their factories.CREATE [OR REPLACE] SECRET [IF NOT EXISTS]andDROP SECRET [IF EXISTS], using the same store as programmatic operations. Secrets are generic string option collections; providers interpret their fields and named references.What is the testing strategy for this PR?
Added 27 Rust tests plus
secrets.slt, covering the store, SQL parser/planner, session execution, and protobuf/JSON connection-plan boundaries. Validation on Rust 1.99.1:datafusion-examples,datafusion-benchmarks, anddatafusion-cli, as in the contributor instructions; enabledavro,json,backtrace,extended_tests,recursive_protection,parquet_encryption.cargo run --locked --profile ci -p datafusion-examples --example data_io -- secretspassed.cargo fmt --all -- --checkandcargo clippy --locked --profile ci --all-targets --all-features --keep-going -- -D warningspassed.Existing
sql_plannerbenchmarks compared againstf9bc5a3fc60cc7f4319cd2c156cb3d024a8c1b21, with independent target directories and the normal optimized release/LTO profile. Initial baseline/fixed/baseline/fixed runs used 20 samples, 1 s warm-up and 3 s measurement per case. Times below are microseconds per iteration; TPC-H is 21 schema-only logical plans.logical_select_one_from_700logical_wide_filter_200_predicateslogical_plan_tpch_allThe initial wide-filter difference warranted a longer check with the same binaries, 5 s warm-up, 8 s measurement and 30 samples. Other task builds were paused for both sets of measurements:
The initial large gap did not reproduce; this local check establishes neither a performance improvement nor universal absence of regressions. Compiled production sources were unchanged during measurement; subsequent edits to the session unit-test iterator and a separate protobuf integration test were excluded from this benchmark target.
Tests include duplicate/replacement/removal semantics, concurrent creates/removes, session sharing/isolation, custom stores, wrong/missing credentials, DDL restrictions, canary redaction, native parser compatibility, and reference-only plan roundtrips.
Are there any user-facing changes?
Yes: new session APIs and CREATE/DROP SECRET SQL, documented with an example and migration notes.
DdlStatementand SQL parserStatementgainCreateSecretandDropSecretvariants; downstream exhaustive matches must handle them. TheSessiontrait method has a default implementation so existing implementors continue to compile. The default store is session-scoped plaintext memory; persistence, authorization, external secret-manager integrations, and automatic object-store configuration are outside this initial implementation. Names/references remain visible, raw SQL can still be retained by callers, and removing a secret does not revoke existing provider connections or snapshots.