From 81c912d251bc138f3886858940d5b5c21c4eb787 Mon Sep 17 00:00:00 2001 From: Alisson Patricio Date: Mon, 26 Jul 2021 17:37:00 -0300 Subject: [PATCH] don't use encrypted and trust options for secure schemas (#568) --- Changelog | 3 +++ neomodel/util.py | 29 +++++++++++++++++------------ setup.py | 2 +- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Changelog b/Changelog index b59a20d0..cf97c52f 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +Version 4.0.5 2021-07-26 +* Fix issue with secure schema + Version 4.0.4 2021-07-01 * Fix for docker tests (#479) * Add support for slow query log (#480) diff --git a/neomodel/util.py b/neomodel/util.py index 7f750e3d..b5a8573f 100644 --- a/neomodel/util.py +++ b/neomodel/util.py @@ -100,18 +100,23 @@ def set_connection(self, url): raise ValueError("Expecting url format: bolt://user:password@localhost:7687" " got {0}".format(url)) - self.driver = GraphDatabase.driver(u.scheme + '://' + hostname, - auth=basic_auth(username, password), - connection_acquisition_timeout=config.CONNECTION_ACQUISITION_TIMEOUT, - connection_timeout=config.CONNECTION_TIMEOUT, - encrypted=config.ENCRYPTED, - keep_alive=config.KEEP_ALIVE, - max_connection_lifetime=config.MAX_CONNECTION_LIFETIME, - max_connection_pool_size=config.MAX_CONNECTION_POOL_SIZE, - max_transaction_retry_time=config.MAX_TRANSACTION_RETRY_TIME, - resolver=config.RESOLVER, - trust=config.TRUST, - user_agent=config.USER_AGENT) + options = dict( + auth=basic_auth(username, password), + connection_acquisition_timeout=config.CONNECTION_ACQUISITION_TIMEOUT, + connection_timeout=config.CONNECTION_TIMEOUT, + keep_alive=config.KEEP_ALIVE, + max_connection_lifetime=config.MAX_CONNECTION_LIFETIME, + max_connection_pool_size=config.MAX_CONNECTION_POOL_SIZE, + max_transaction_retry_time=config.MAX_TRANSACTION_RETRY_TIME, + resolver=config.RESOLVER, + user_agent=config.USER_AGENT + ) + + if "+s" not in u.scheme: + options['encrypted'] = config.ENCRYPTED + options['trust'] = config.TRUST + + self.driver = GraphDatabase.driver(u.scheme + '://' + hostname, **options) self.url = url self._pid = os.getpid() self._active_transaction = None diff --git a/setup.py b/setup.py index 1e7fcefa..820c993e 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='neomodel', - version='4.0.4', + version='4.0.5', description='An object mapper for the neo4j graph database.', long_description=open('README.rst').read(), author='Robin Edwards',