Repository navigation
chore: the Snowflake Kamelets can log in with a key pair (#3170) - #3208
Merged
Merged
Conversation
This was referenced Nov 18, 2026
davsclaus
added a commit
to davsclaus/camel-kamelets
that referenced
this pull request
Nov 18, 2026
… JSON array of rows, and size the connection pool (apache#3170) The PostgreSQL, MySQL, MariaDB, SQL Server and Oracle Database Kamelets take new optional options. With them unset, the endpoint URIs are the same as before, apart from oracle-database-source (see below). Sources (postgresql, mysql, mariadb, sqlserver, oracle-database): - maxMessagesPerPoll: the most rows one poll sends. - onConsumeFailed: an SQL statement run for a row whose processing failed, such as marking it as failed. - onConsumeBatchComplete: an SQL statement run once after the rows of a poll are sent. - initialDelay: how long to wait before the first poll. - useIterator: false sends all the rows of a poll as one JSON array. - routeEmptyResultSet: with useIterator false, sends [] when no rows are found. oracle-database-source gets the delay option the other sources have, with the same default of 500 ms. Its endpoint now carries delay=500, which is the delay it had before. Sinks: batch accepts a JSON array of objects and writes one row for each, in one transaction. A single object still works. All ten: maxTotal, maxIdle and maxWaitMillis set the commons-dbcp2 connection pool. transacted is left out: without a Spring transaction manager it starts no transaction, and a failed row stops the source for good. Snowflake is left out, as apache#3208 changes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
snowflake-source and snowflake-sink logged in only with a username and a
password. A Snowflake user of TYPE=SERVICE cannot log in with a password,
and Snowflake is phasing out sign-in with a password alone for the other
users, so such a Kamelet stops working for a service user.
The Kamelets now take a private key, either as text in privateKey (the PEM
file encoded in base64, the driver's private_key_base64) or as a path in
privateKeyFile (private_key_file), and privateKeyPassphrase
(private_key_pwd) for an encrypted key. They go into the properties map of
the Snowflake data source, as its two-argument setters cannot be bound.
With a key present and no authenticator set, the driver logs in with
SNOWFLAKE_JWT and does not send the password.
password is now optional. It is bound as {{password:}}, an empty default,
because an optional placeholder skips the setter and the data source then
refuses to connect without a password, before the driver looks at the key.
With neither a password nor a key, the driver fails with "Missing password."
With the new options unset, the endpoint URIs and the login request sent
to Snowflake are the same as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
davsclaus
force-pushed
the
ci-issue-3170-snowflake
branch
from
November 18, 2026 20:01
d5d3447 to
2abfb32
Compare
This was referenced Nov 18, 2026
davsclaus
added a commit
that referenced
this pull request
Nov 18, 2026
… JSON array of rows, and size the connection pool (#3170) (#3215) The PostgreSQL, MySQL, MariaDB, SQL Server and Oracle Database Kamelets take new optional options. With them unset, the endpoint URIs are the same as before, apart from oracle-database-source (see below). Sources (postgresql, mysql, mariadb, sqlserver, oracle-database): - maxMessagesPerPoll: the most rows one poll sends. - onConsumeFailed: an SQL statement run for a row whose processing failed, such as marking it as failed. - onConsumeBatchComplete: an SQL statement run once after the rows of a poll are sent. - initialDelay: how long to wait before the first poll. - useIterator: false sends all the rows of a poll as one JSON array. - routeEmptyResultSet: with useIterator false, sends [] when no rows are found. oracle-database-source gets the delay option the other sources have, with the same default of 500 ms. Its endpoint now carries delay=500, which is the delay it had before. Sinks: batch accepts a JSON array of objects and writes one row for each, in one transaction. A single object still works. All ten: maxTotal, maxIdle and maxWaitMillis set the commons-dbcp2 connection pool. transacted is left out: without a Spring transaction manager it starts no transaction, and a failed row stops the source for good. Snowflake is left out, as #3208 changes it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part of #3170:
snowflake-sourceandsnowflake-sinkcan log in with a key pair, as well as with a password.The problem
Both Kamelets logged in only with
usernameandpassword. Snowflake is phasing out sign-in with a password alone:Snowflake's user management page says users of
TYPE=SERVICE"cannot log in using a password". The CREATE USER reference describesLEGACY_SERVICEas "similar to SERVICE, but allows password authentication", and says that type is being deprecated.Snowflake's rollout plan (read on 2026-11-18) has three phases:
LEGACY_SERVICEcan no longer be set.LEGACY_SERVICEusers are migrated toSERVICE.Enforcement dates "vary by account, and may be extended". Reader accounts, trial accounts and Snowflake Postgres are exempt.
So a Kamelet that can only send a password stops working for a service user. Snowflake documents key-pair authentication for clients like this one.
The options
The data source bean is still
SnowflakeDataSourceFactory.createDataSource(). The driver issnowflake-jdbc4.3.4, asspec.dependenciesdeclares. ItssetPrivateKeyBase64(key, pwd)andsetPrivateKeyFile(path, pwd)take two arguments, so a bean property cannot call them. The template therefore puts the driver's connection properties into the data source'spropertiesmap. The property names are taken fromSFSessionPropertyin the 4.3.4 sources.dsBean)privateKeyproperties[private_key_base64]: "{{?privateKey}}"base64 -w0 rsa_key.p8).format: password.privateKeyFileproperties[private_key_file]: "{{?privateKeyFile}}"privateKeyPassphraseproperties[private_key_pwd]: "{{?privateKeyPassphrase}}"format: password.password(now optional)password: "{{password:}}"(was"{{password}}")authenticatorset, it usesSNOWFLAKE_JWTwhenever a private key property is present, and it then does not send the password.{{password:}}and not{{?password}}: an optional placeholder that resolves to nothing skips the setter, so the data source's password staysnull. The data source then refuses to connect before the driver even looks at the key: "Cannot create connection because password is missing in DataSource properties". This happened in a test with{{?password}}."". For key login, the empty password is never sent.Missing password.before any request.{{?x}}: when they are unset, the setter is skipped, so no key property is put into the map. That matters here because the driver treats an empty string as a key. The unset case below proves it: the password login request is identical tomain's.private_key_base64is the driver's only text form. It is the PEM file encoded in base64; the PEM text itself fails withPrivate key provided is invalid or not supported. The file option covers a Secret mounted as a file.openssl pkcs8 -topk8 -v2 aes-256-cbc, worked from both options.pattern:: none of the options goes into a URI. The bean receives them directly.passworddescription gives theMissing passworderror.Verification
There is no local Snowflake. Instead, I captured the driver's login request with a stand-in: a small Python HTTP server that writes each
POST /session/v1/login-requestbody (gunzipped) to a file and answers with Snowflake's login-failure JSON.instanceUrlwaslocalhost:18099/?ssl=off&account=MYACCOUNT. These are driver connect-string parameters, used for the test only.-nocrypt) and one encrypted with-v2 aes-256-cbc.SHA256:fingerprint inisswith the fingerprint of the matching.pubfile (SHA-256 of the DER public key, as Snowflake computes it), and check the RS256 signature withopenssl dgst -verify.Tested with Camel JBang 4.24.0-SNAPSHOT,
camel run ... --local-kamelet-dir:passwordonly,mainand this branchPASSWORDsent, noAUTHENTICATOR.camel get endpointshows the samelocal-sql-snowflake-*-1://...?dataSource=#bean:dsBean-2URIs on bothprivateKey(base64 of unencrypted PEM), no passwordAUTHENTICATOR=SNOWFLAKE_JWT, noPASSWORD. TheTOKENis an RS256 JWT,sub=MYACCOUNT.MY_USER,iss=MYACCOUNT.MY_USER.SHA256:K6xv…, which matchesrsa_key.pub. SignatureVerified OKwith that key,Verification failurewith the other keyprivateKeyFile(unencrypted PEM)rsa_key.pubprivateKey(base64 of encrypted PEM) +privateKeyPassphraseissfingerprintSHA256:5358…matchesrsa_key_enc.pub, signature verifiedprivateKeyFile(encrypted PEM) +privateKeyPassphrasersa_key_enc.pubprivateKeyset in the route'sparametersfrom a property, value containing+,/and=privateKeyandpasswordboth setMissing password.; no request reaches the serverprivateKeyandprivateKeyFileboth setCannot have both private key file and private key base64 string valueprivateKeyset to the PEM text, not base64Private key provided is invalid or not supported; no requestPrivate key provided is invalid or not supported: ... Error finalising cipher; no requestNullPointerExceptionfrom the driver (privateKeyPwdis null); no requestprivateKeyFilethat does not existInvalid parameter value null for parameter type {1}.; no request./mvnw clean verify -DskipTestsand then./mvnw clean verifypassed from the root. Before building, the library copies of both Kamelets were refreshed with./mvnw -pl library/camel-kamelets resources:copy-resources@copy-resource-one. The build regeneratedkamelets-index.json.Claude Code on behalf of Claus Ibsen
🤖 Generated with Claude Code