sql: redact inline credentials in CREATE CONNECTION options#37421
Open
def- wants to merge 1 commit into
Open
Conversation
866ec5f to
febe2fd
Compare
ConnectionOptionName::redact_value returned false for every variant, which forced the with-option display macro to unredact the value. Credential-bearing options that carried inline credentials could therefore print live credentials into the redacted-telemetry channel, including mz_sql_text_redacted, catalog create_sql round-trips, and trace attributes. Return true for credential-bearing variants so inline credential values render as '<REDACTED>'. A SECRET reference is a catalog item name, not the credential itself, so WithOptionValue::Secret renders that name in redacted mode, keeping redacted connection SQL diagnostic. Parse sensitive CREATE CONNECTION option values with credential-specific semantics. SECRET <name> remains a secret reference, while quoted and bare inline credentials are normalized to Value::String before display. This closes the bare-identifier bypass for forms like USER = myuser, SASL USERNAME = svcacct, ACCESS KEY ID = AKIAEXAMPLE, and CREDENTIAL = cred_leak. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
febe2fd to
9453d70
Compare
Contributor
Author
|
Nightly failure is unrelated, ready for review |
aljoscha
approved these changes
Jul 6, 2026
aljoscha
left a comment
Contributor
There was a problem hiding this comment.
had one inline comment that would be good to address, but otherwise looks good!
| } | ||
|
|
||
| impl ConnectionOptionName { | ||
| pub(crate) fn value_contains_sensitive_data(&self) -> bool { |
Contributor
There was a problem hiding this comment.
should this be an exhaustive destructure, so we don't miss new variants in the future?
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.
ConnectionOptionName::redact_value returned false for every variant, which forced the with-option display macro to unredact the value. Credential-bearing options that carried inline credentials could therefore print live credentials into the redacted-telemetry channel, including mz_sql_text_redacted, catalog create_sql round-trips, and trace attributes.
This PR keeps credential-bearing option values in redacted mode so inline credential values render as
<REDACTED>. ASECRETreference is a catalog item name, not the credential itself, soWithOptionValue::Secretrenders that name in redacted mode, keeping redacted connection SQL diagnostic.The parser now handles sensitive
CREATE CONNECTIONoption values with credential-specific semantics.SECRET <name>remains a secret reference, while quoted and bare inline credentials are normalized toValue::Stringbefore display. This closes the bare-identifier bypass for forms likeUSER = myuser,SASL USERNAME = svcacct,ACCESS KEY ID = AKIAEXAMPLE, andCREDENTIAL = cred_leak.Tests added or modified:
test_connection_option_redactionwith quoted credentials,SECRETreferences, and bare credential identifiers.src/sql-parser/tests/testdata/sourcefor the new raw AST and display representation of bare SQL ServerUSERvalues.