phoenix24 commented on a change in pull request #4258: [AIRFLOW-3423] Fix 
unauthenticated access for mongo hook
URL: https://github.com/apache/incubator-airflow/pull/4258#discussion_r242304078
 
 

 ##########
 File path: airflow/contrib/hooks/mongo_hook.py
 ##########
 @@ -56,11 +56,11 @@ def get_conn(self):
         uri = 'mongodb://{creds}{host}{port}/{database}'.format(
             creds='{}:{}@'.format(
                 conn.login, conn.password
-            ) if conn.login is not None else '',
+            ) if conn.login else '',
 
             host=conn.host,
             port='' if conn.port is None else ':{}'.format(conn.port),
-            database='' if conn.schema is None else conn.schema
+            database=conn.schema
 
 Review comment:
   This would lead to a scenario, where 
`uri=mongodb://{creds}{host}{port}/None`, and would lead to accessing a 
database `None` if it were to exist.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to