-
Notifications
You must be signed in to change notification settings - Fork 700
feat(connector): support key-pair authentication for Snowflake sink #23525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license-eye has checked 6003 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 2534 | 1 | 3468 | 0 |
Click to see the invalid file list
- java/connector-node/risingwave-jdbc-runner/src/test/java/com/risingwave/runner/JDBCSqlRunnerTest.java
Use this command to fix any missing license headers
```bash
docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix
</details>
...ector-node/risingwave-jdbc-runner/src/test/java/com/risingwave/runner/JDBCSqlRunnerTest.java
Show resolved
Hide resolved
…isingwave/runner/JDBCSqlRunnerTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds key-pair authentication support for the Snowflake sink connector, providing a more secure alternative to password-based authentication. Users can authenticate using RSA private keys via either file paths or direct PEM content.
Key changes:
- Added three authentication methods: password (default), key_pair_file, and key_pair_object
- Implemented PEM parsing and private key conversion in Java using BouncyCastle
- Extended JDBC connection handling to pass authentication properties through JNI
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
with_options_sink.yaml |
Added new auth configuration fields for Snowflake sink |
snowflake.rs |
Implemented auth method validation and JDBC property building logic |
jdbc_jni_client.rs |
Extended JNI client to pass driver properties alongside JDBC URL |
SnowflakeJDBCSinkConfig.java |
New Snowflake-specific config class with key-pair auth support |
JdbcUtils.java |
Refactored connection creation to support specialized auth methods |
JDBCSinkFactory.java |
Added factory logic to instantiate SnowflakeJDBCSinkConfig |
JDBCSinkConfig.java |
Added overridable getConnection() method |
JDBCSink.java |
Migrated to use config.getConnection() pattern |
BatchAppendOnlyJDBCSink.java |
Migrated to use config.getConnection() pattern |
pom.xml (sink-jdbc) |
Added BouncyCastle dependencies for cryptography |
test-private-key.pem |
Test fixture for private key validation |
JDBCSqlRunnerTest.java |
Unit test for PEM loading functionality |
JDBCSqlRunner.java |
Updated to handle authentication properties via JNI |
pom.xml (jdbc-runner) |
Added test dependencies and sink-jdbc reference |
...connector-node/risingwave-jdbc-runner/src/main/java/com/risingwave/runner/JDBCSqlRunner.java
Show resolved
Hide resolved
...ode/risingwave-sink-jdbc/src/main/java/com/risingwave/connector/SnowflakeJDBCSinkConfig.java
Outdated
Show resolved
Hide resolved
...connector-node/risingwave-jdbc-runner/src/main/java/com/risingwave/runner/JDBCSqlRunner.java
Outdated
Show resolved
Hide resolved
|
QQ: do we support using file secret to pass the private key to snowflake jdbc? |
yes and tested mannually |
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR adds support for key-pair authentication (using RSA private keys) for the Snowflake sink connector, in addition to the existing password-based authentication.
Context: https://docs.snowflake.com/en/user-guide/security-mfa-rollout
Summary
password(default): Standard username/password authenticationkey_pair_file: Uses a private key file path for authenticationkey_pair_object: Uses PEM-formatted private key content for authenticationHow it works
Java connector changes:
SnowflakeJDBCSinkConfigclass that extendsJDBCSinkConfigwith Snowflake-specific authentication fieldshandleSnowflakeAuth()method to process different authentication methodskey_pair_objectmethod converts PEM content to a JavaPrivateKeyobject that Snowflake JDBC driver can useRust connector changes:
auth.method,private_key_file,private_key_file_pwd, andprivate_key_pemConfiguration options:
Checklist
Documentation
Release note
The Snowflake sink connector now supports key-pair authentication using RSA private keys, providing a more secure alternative to password-based authentication. Users can specify private keys either via file paths or by providing PEM-formatted key content directly, making it easier to integrate with secret management systems.
To use key-pair authentication, set
auth.methodto eitherkey_pair_fileorkey_pair_objectand provide the necessary private key configuration.🤖 Generated with Claude Code