multiwoven-integrations 0.43.14 → 0.43.15

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: 24bab48006a2c799396188baf7da5bcc9e1491cf1f51aad9f042d4ed936790a2
4
- data.tar.gz: 239cbb4dde0911e3be43ca2b2e4dbe573ea068f61f2e3b976d0efb521c77f778
3
+ metadata.gz: 9618db7b11f17436e8afeb245fe6b0f1fadabb007e6c71853ce0a49aec2dd9c0
4
+ data.tar.gz: 57205afb09b1a0dd207a50e8bdb58a279040c280c01cc8c589213a19582b5f12
5
5
  SHA512:
6
- metadata.gz: 9c5429086ec102e343093fc12b145c2a2867a41afb7f70512da5576c71c457f631514fccd912ff7e7c72fb1bc83dcb648fac75d8ab910959e0aab9fea2178bd6
7
- data.tar.gz: fc1227e6afe772de839b2d4f293a876368e5cd13abac15dbcfb40a2e9ce65a9f1d98324628ad22dc6e5ed9a90dc38d7592714d4631f251fbc2ef70ee5a31f4bf
6
+ metadata.gz: 4a36b1bb37177df28a9326823838ef2723204fb550e63c06c0b091df0cd1526c1d30fd155c495db92f45b486e592d349cefdff1741785b32e4fc3ad53d42127a
7
+ data.tar.gz: 488345a181eb411111219dde4ebd2c3d90f210f9fefbd511e61795ace0815a6d52e02b142b7562138be9dc53a5e7e8a6b4c44b284f5fa63aab0dba832d74bb9a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ### [0.43.15]
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Postgres connectors reach the hosted data store host only on `HOSTED_VECTOR_DB_PORT` with a per-schema read or write role (`hds_<database>_<schema>_read` or `_write`) and a password. The server's own hosted login, any other user name on that host, a blank password, any other port, and a schema role on any other private host are blocked
9
+
3
10
  ### [0.43.14]
4
11
 
5
12
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_support/security_utils"
4
3
  require "ipaddr"
5
4
  require "socket"
6
5
 
@@ -39,8 +38,8 @@ module Multiwoven
39
38
  ALLOW_PRIVATE_NETWORK_ENV = "CONNECTOR_ALLOW_PRIVATE_NETWORK"
40
39
  PRIVATE_NETWORK_ALLOWLIST_ENV = "CONNECTOR_PRIVATE_NETWORK_ALLOWLIST"
41
40
  HOSTED_DATABASE_HOST_ENV = "HOSTED_VECTOR_DB_HOST"
42
- HOSTED_DATABASE_USERNAME_ENV = "HOSTED_VECTOR_DB_USERNAME"
43
- HOSTED_DATABASE_PASSWORD_ENV = "HOSTED_VECTOR_DB_PASSWORD"
41
+ HOSTED_DATABASE_PORT_ENV = "HOSTED_VECTOR_DB_PORT"
42
+ HOSTED_SCHEMA_ROLE = /\Ahds_\w+_(?:read|write)\z/.freeze
44
43
  BLOCKED_HOST_ERROR = "This host points to a private or internal network address, which connectors cannot reach. " \
45
44
  "Self-hosted deployments can allow it with #{ALLOW_PRIVATE_NETWORK_ENV} or #{PRIVATE_NETWORK_ALLOWLIST_ENV}"
46
45
  UNRESOLVED_HOST_ERROR = "This host name could not be resolved"
@@ -93,7 +92,8 @@ module Multiwoven
93
92
  ensure_allowed_host!("#{bucket.to_s.strip}.#{url_host(endpoint.to_s.strip)}")
94
93
  end
95
94
 
96
- # Hosted data store connectors carry the server's own database host and login, which is private by design.
95
+ # Hosted data store connectors carry the server's own database host and port, which are private by design,
96
+ # with a per-schema role. Postgres still checks the role's password.
97
97
  def ensure_allowed_database_host!(connection_config)
98
98
  return if hosted_database_connection?(connection_config)
99
99
 
@@ -101,17 +101,19 @@ module Multiwoven
101
101
  end
102
102
 
103
103
  def hosted_database_connection?(connection_config)
104
- hosted_host, hosted_username, hosted_password = [HOSTED_DATABASE_HOST_ENV, HOSTED_DATABASE_USERNAME_ENV, HOSTED_DATABASE_PASSWORD_ENV]
105
- .map { |name| ENV.fetch(name, "") }
106
- return false if [hosted_host, hosted_username, hosted_password].any? { |value| value.strip.empty? }
104
+ hosted_host, hosted_port = [HOSTED_DATABASE_HOST_ENV, HOSTED_DATABASE_PORT_ENV].map { |name| ENV.fetch(name, "").strip }
105
+ return false if hosted_host.empty? || hosted_port.empty?
107
106
 
108
107
  host = connection_config[:host].to_s.strip.downcase
109
108
  return false if host.match?(COMPOUND_HOST_CHARACTERS)
109
+ return false unless host.delete_suffix(".") == hosted_host.downcase.delete_suffix(".")
110
+ return false unless connection_config[:port].to_s.strip == hosted_port
110
111
 
111
- credentials = connection_config[:credentials] || {}
112
- host.delete_suffix(".") == hosted_host.strip.downcase.delete_suffix(".") &&
113
- ActiveSupport::SecurityUtils.secure_compare(credentials[:username].to_s, hosted_username) &&
114
- ActiveSupport::SecurityUtils.secure_compare(credentials[:password].to_s, hosted_password)
112
+ hosted_schema_role?(connection_config[:credentials] || {})
113
+ end
114
+
115
+ def hosted_schema_role?(credentials)
116
+ credentials[:username].to_s.match?(HOSTED_SCHEMA_ROLE) && !credentials[:password].to_s.strip.empty?
115
117
  end
116
118
 
117
119
  def ensure_valid_port!(port)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.43.14"
5
+ VERSION = "0.43.15"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiwoven-integrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.43.14
4
+ version: 0.43.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subin T P