datagrout-conduit 0.8.2 → 0.8.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5f3083e66b890a25b3fe77e4fd86e7e72ba3d86af8a530477ad93334de26f19
4
- data.tar.gz: 16bb086f9c923bacad3fe8fc228eb5ea024a475a33bba51f320aad00fa032f56
3
+ metadata.gz: ec9cfe7efc9431d776d64624de9f78a78acb96aaede8656434414be3d1fa5df2
4
+ data.tar.gz: d6d9b3e9b3c9cf16516b71d5b23a9ddd93ab7e8d134764d43b86d020ad331151
5
5
  SHA512:
6
- metadata.gz: a38b2be0474f517414da7731565fac6a4327664f84b7b95f9e04d478f29183087ac4da84899fbba952bbba11244386735ecd564c1a422038c8baef3b45141d10
7
- data.tar.gz: 82f0c8a811e8165f1a5c91dcc5c3f93121115cc49d9969774e6b0a2c65d63afb2cf34d646c1042039f52182db2bca2084982d75dee76c56c0ad612405132ec66
6
+ metadata.gz: 5dd88750a33fd8359a45ca525e61a79f593bebb3334b17c888df7232e892965efefa6c76edb5d72445990a499dee473a2b13543ee165ea6928dd627ff146c340
7
+ data.tar.gz: be8e4676d63287463605dac5b278ce45b85d811373c9fdadc3a7897eb702356ba2d3eb34c047cfb124684011692333fa7edb1bffc6f35d7551d3af72be502f2f
data/README.md CHANGED
@@ -9,13 +9,13 @@ Connect to remote MCP and JSONRPC servers, invoke tools, discover capabilities w
9
9
  Add to your Gemfile:
10
10
 
11
11
  ```ruby
12
- gem "datagrout-conduit", "~> 0.8.1"
12
+ gem "datagrout-conduit", "~> 0.8.3"
13
13
  ```
14
14
 
15
15
  Or install directly:
16
16
 
17
17
  ```sh
18
- gem install datagrout-conduit -v 0.8.1
18
+ gem install datagrout-conduit -v 0.8.3
19
19
  ```
20
20
 
21
21
  ## Quick Start
@@ -127,15 +127,33 @@ module DatagroutConduit
127
127
  @ca_pem ? OpenSSL::X509::Certificate.new(@ca_pem) : nil
128
128
  end
129
129
 
130
+ # Every certificate in the CA bundle, which may hold more than one.
131
+ def ca_certificates
132
+ return [] unless @ca_pem
133
+
134
+ @ca_pem.scan(/-----BEGIN CERTIFICATE-----.+?-----END CERTIFICATE-----/m)
135
+ .map { |pem| OpenSSL::X509::Certificate.new(pem) }
136
+ end
137
+
138
+ # The trust store for a connection made with this identity: the system's
139
+ # default roots plus this identity's CA (every certificate in the bundle).
140
+ #
141
+ # A store holding only the identity's CA rejects every publicly-issued
142
+ # server certificate, and a DataGrout-issued identity carries the
143
+ # DataGrout CA while the gateway itself presents a public certificate.
144
+ # Rust's `build_connector` is the reference: webpki roots plus the CA.
145
+ def cert_store
146
+ store = OpenSSL::X509::Store.new
147
+ store.set_default_paths
148
+ ca_certificates.each { |cert| store.add_cert(cert) }
149
+ store
150
+ end
151
+
130
152
  # Configure Faraday SSL options with this identity's mTLS credentials.
131
153
  def configure_ssl(ssl)
132
154
  ssl.client_cert = openssl_cert
133
155
  ssl.client_key = openssl_key
134
- if @ca_pem
135
- store = OpenSSL::X509::Store.new
136
- store.add_cert(openssl_ca)
137
- ssl.cert_store = store
138
- end
156
+ ssl.cert_store = cert_store if @ca_pem
139
157
  end
140
158
 
141
159
  class << self
@@ -59,13 +59,7 @@ module DatagroutConduit
59
59
  end
60
60
 
61
61
  def configure_ssl(faraday)
62
- faraday.ssl.client_cert = @identity.openssl_cert
63
- faraday.ssl.client_key = @identity.openssl_key
64
- if @identity.ca_pem
65
- store = OpenSSL::X509::Store.new
66
- store.add_cert(@identity.openssl_ca)
67
- faraday.ssl.cert_store = store
68
- end
62
+ @identity.configure_ssl(faraday.ssl)
69
63
  end
70
64
 
71
65
  def build_headers
@@ -321,11 +321,8 @@ module DatagroutConduit
321
321
  if @identity
322
322
  ctx.cert = @identity.openssl_cert
323
323
  ctx.key = @identity.openssl_key
324
- if @identity.ca_pem
325
- store = OpenSSL::X509::Store.new
326
- store.add_cert(@identity.openssl_ca)
327
- ctx.cert_store = store
328
- end
324
+ # The system roots plus the identity's CA, never the CA alone.
325
+ ctx.cert_store = @identity.cert_store if @identity.ca_pem
329
326
  end
330
327
 
331
328
  ctx
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatagroutConduit
4
- VERSION = "0.8.2"
4
+ VERSION = "0.8.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datagrout-conduit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - DataGrout