rb_snowflake_client 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +14 -11
- data/README.md +3 -0
- data/lib/ruby_snowflake/client/key_pair_jwt_auth_manager.rb +4 -4
- data/lib/ruby_snowflake/client.rb +3 -2
- data/lib/ruby_snowflake/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d4e6f5f28c211ce79c5c049125008efdbddca46ecb670f7bc724a10c11eb5ef
|
|
4
|
+
data.tar.gz: 42378b7321d2ce549b347b5f882d85af33f393a4a34e3032fa22e5bbbaa264e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33be4299bb251eb3be2ddef2301ab6e471c1a312d3a35dab3a2067d757125eec473aecf230bd84544992714e4dc7ab23b4a2129c8a460c5654eadb68de5f0109
|
|
7
|
+
data.tar.gz: 71ed8816683f48ed434fdb44515a3e92d0121d8935cc1e89c41a4accef4431ef5448c2feed0355df66cc04d17a1e88afcc7732a5a56af915d85e8345b84bd49a
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## [1.6.0] - 2026-04-13
|
|
11
|
+
### Added
|
|
12
|
+
- Support for passing a passphrase when using an encrypted private key for JWT authentication (#166)
|
|
13
|
+
### Security
|
|
14
|
+
- Bumped `activesupport` to patch CVEs (#167)
|
|
15
|
+
|
|
10
16
|
## [1.5.0] - 2025-10-14
|
|
11
17
|
### Added
|
|
12
18
|
- Instrumentation feature added for Active Support users
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rb_snowflake_client (1.
|
|
4
|
+
rb_snowflake_client (1.6.0)
|
|
5
5
|
bigdecimal (>= 3.0)
|
|
6
6
|
concurrent-ruby (>= 1.2)
|
|
7
7
|
connection_pool (>= 2.4)
|
|
@@ -13,7 +13,7 @@ PATH
|
|
|
13
13
|
GEM
|
|
14
14
|
remote: https://rubygems.org/
|
|
15
15
|
specs:
|
|
16
|
-
activesupport (8.0.
|
|
16
|
+
activesupport (8.0.5)
|
|
17
17
|
base64
|
|
18
18
|
benchmark (>= 0.3)
|
|
19
19
|
bigdecimal
|
|
@@ -27,23 +27,26 @@ GEM
|
|
|
27
27
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
28
28
|
uri (>= 0.13.1)
|
|
29
29
|
base64 (0.3.0)
|
|
30
|
-
benchmark (0.
|
|
31
|
-
bigdecimal (
|
|
30
|
+
benchmark (0.5.0)
|
|
31
|
+
bigdecimal (4.1.1)
|
|
32
32
|
coderay (1.1.3)
|
|
33
|
-
concurrent-ruby (1.3.
|
|
34
|
-
connection_pool (
|
|
33
|
+
concurrent-ruby (1.3.6)
|
|
34
|
+
connection_pool (3.0.2)
|
|
35
35
|
diff-lcs (1.6.2)
|
|
36
36
|
dotenv (3.1.8)
|
|
37
37
|
drb (2.2.3)
|
|
38
|
-
i18n (1.14.
|
|
38
|
+
i18n (1.14.8)
|
|
39
39
|
concurrent-ruby (~> 1.0)
|
|
40
40
|
json (2.15.1)
|
|
41
41
|
jwt (3.1.2)
|
|
42
42
|
base64
|
|
43
43
|
logger (1.7.0)
|
|
44
44
|
method_source (1.1.0)
|
|
45
|
-
minitest (
|
|
45
|
+
minitest (6.0.3)
|
|
46
|
+
drb (~> 2.0)
|
|
47
|
+
prism (~> 1.5)
|
|
46
48
|
parallel (1.27.0)
|
|
49
|
+
prism (1.9.0)
|
|
47
50
|
pry (0.15.2)
|
|
48
51
|
coderay (~> 1.1)
|
|
49
52
|
method_source (~> 1.0)
|
|
@@ -65,14 +68,14 @@ GEM
|
|
|
65
68
|
securerandom (0.4.1)
|
|
66
69
|
tzinfo (2.0.6)
|
|
67
70
|
concurrent-ruby (~> 1.0)
|
|
68
|
-
uri (1.
|
|
71
|
+
uri (1.1.1)
|
|
69
72
|
|
|
70
73
|
PLATFORMS
|
|
71
74
|
arm64-darwin-22
|
|
72
75
|
ruby
|
|
73
76
|
|
|
74
77
|
DEPENDENCIES
|
|
75
|
-
activesupport
|
|
78
|
+
activesupport (~> 8.0.4, >= 8.0.4.1)
|
|
76
79
|
bundler
|
|
77
80
|
parallel
|
|
78
81
|
pry
|
|
@@ -81,4 +84,4 @@ DEPENDENCIES
|
|
|
81
84
|
rspec
|
|
82
85
|
|
|
83
86
|
BUNDLED WITH
|
|
84
|
-
|
|
87
|
+
4.0.3
|
data/README.md
CHANGED
|
@@ -48,6 +48,8 @@ Available ENV variables (see below in the config section for details)
|
|
|
48
48
|
- `SNOWFLAKE_URI`
|
|
49
49
|
- `SNOWFLAKE_PRIVATE_KEY_PATH` or `SNOWFLAKE_PRIVATE_KEY`
|
|
50
50
|
- Use either the key or the path. Key takes precedence if both are provided.
|
|
51
|
+
- `SNOWFLAKE_PRIVATE_KEY_PASSPHRASE`
|
|
52
|
+
- Optional, if you are using an encrypted private key
|
|
51
53
|
- `SNOWFLAKE_ORGANIZATION`
|
|
52
54
|
- Optional, if you leave it off, the library will authenticate with an account name of only SNOWFLAKE_ACCOUNT
|
|
53
55
|
- `SNOWFLAKE_ACCOUNT`
|
|
@@ -265,6 +267,7 @@ or alternatively, use the client to verify:
|
|
|
265
267
|
client = RubySnowflake::Client.new(
|
|
266
268
|
"https://yourinstance.region.snowflakecomputing.com", # insert your URL here
|
|
267
269
|
File.read("secrets/my_key.pem"), # path to your private key
|
|
270
|
+
"private-key-passphrase", # your private key passphrase, if it has one (defaults to nil)
|
|
268
271
|
"snowflake-organization", # your account name (doesn't match your URL), using nil may be required depending on your snowflake account
|
|
269
272
|
"snowflake-account", # typically your subdomain
|
|
270
273
|
"snowflake-user", # Your snowflake user
|
|
@@ -8,12 +8,13 @@ module RubySnowflake
|
|
|
8
8
|
class Client
|
|
9
9
|
class KeyPairJwtAuthManager
|
|
10
10
|
# requires text of a PEM formatted RSA private key
|
|
11
|
-
def initialize(organization, account, user, private_key, jwt_token_ttl)
|
|
11
|
+
def initialize(organization, account, user, private_key, jwt_token_ttl, private_key_passphrase = nil)
|
|
12
12
|
@organization = organization
|
|
13
13
|
@account = account
|
|
14
14
|
@user = user
|
|
15
15
|
@private_key_pem = private_key
|
|
16
16
|
@jwt_token_ttl = jwt_token_ttl
|
|
17
|
+
@private_key_passphrase = private_key_passphrase
|
|
17
18
|
|
|
18
19
|
# start with an expired value to force creation
|
|
19
20
|
@token_expires_at = Time.now.to_i - 1
|
|
@@ -26,8 +27,7 @@ module RubySnowflake
|
|
|
26
27
|
@token_semaphore.acquire do
|
|
27
28
|
now = Time.now.to_i
|
|
28
29
|
@token_expires_at = now + @jwt_token_ttl
|
|
29
|
-
|
|
30
|
-
private_key = OpenSSL::PKey.read(@private_key_pem)
|
|
30
|
+
private_key = OpenSSL::PKey.read(@private_key_pem, @private_key_passphrase)
|
|
31
31
|
|
|
32
32
|
payload = {
|
|
33
33
|
:iss => "#{account_name}.#{@user.upcase}.#{public_key_fingerprint}",
|
|
@@ -56,7 +56,7 @@ module RubySnowflake
|
|
|
56
56
|
def public_key_fingerprint
|
|
57
57
|
return @public_key_fingerprint unless @public_key_fingerprint.nil?
|
|
58
58
|
|
|
59
|
-
public_key_der = OpenSSL::PKey::RSA.new(@private_key_pem).public_key.to_der
|
|
59
|
+
public_key_der = OpenSSL::PKey::RSA.new(@private_key_pem, @private_key_passphrase).public_key.to_der
|
|
60
60
|
digest = OpenSSL::Digest::SHA256.new.digest(public_key_der)
|
|
61
61
|
fingerprint = Base64.strict_encode64(digest)
|
|
62
62
|
|
|
@@ -97,6 +97,7 @@ module RubySnowflake
|
|
|
97
97
|
new(
|
|
98
98
|
ENV.fetch("SNOWFLAKE_URI"),
|
|
99
99
|
private_key,
|
|
100
|
+
ENV["SNOWFLAKE_PRIVATE_KEY_PASSPHRASE"],
|
|
100
101
|
ENV.fetch("SNOWFLAKE_ORGANIZATION"),
|
|
101
102
|
ENV.fetch("SNOWFLAKE_ACCOUNT"),
|
|
102
103
|
ENV.fetch("SNOWFLAKE_USER"),
|
|
@@ -116,7 +117,7 @@ module RubySnowflake
|
|
|
116
117
|
end
|
|
117
118
|
|
|
118
119
|
def initialize(
|
|
119
|
-
uri, private_key, organization, account, user, default_warehouse, default_database,
|
|
120
|
+
uri, private_key, private_key_passphrase = nil, organization, account, user, default_warehouse, default_database,
|
|
120
121
|
default_role: nil,
|
|
121
122
|
logger: DEFAULT_LOGGER,
|
|
122
123
|
log_level: DEFAULT_LOG_LEVEL,
|
|
@@ -130,7 +131,7 @@ module RubySnowflake
|
|
|
130
131
|
)
|
|
131
132
|
@base_uri = uri
|
|
132
133
|
@key_pair_jwt_auth_manager =
|
|
133
|
-
KeyPairJwtAuthManager.new(organization, account, user, private_key, jwt_token_ttl)
|
|
134
|
+
KeyPairJwtAuthManager.new(organization, account, user, private_key, jwt_token_ttl, private_key_passphrase)
|
|
134
135
|
@default_warehouse = default_warehouse
|
|
135
136
|
@default_database = default_database
|
|
136
137
|
@default_role = default_role
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rb_snowflake_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rinsed
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bigdecimal
|