elastic / connectors

Source code for all Elastic connectors, developed by the Search team at Elastic, and home of our Python connector development framework
https://www.elastic.co/guide/en/enterprise-search/master/index.html
Other
76 stars 129 forks source link

Mongo DB connector improved handling of 'username' and 'password' #1870

Open dcampillo opened 11 months ago

dcampillo commented 11 months ago

Problem Description

The connector configuration doesn't make the username or password required, which allow the user to connect to a MongoDB instance without a 'username' and 'password'. Not a good practise in production, but somehow acceptable on lab or desktop test environment.

If the username and password are empty, the connector throw an exception "TypeError: object of type 'NoneType' has no len()".

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

Proposed Solution

Both username and password are of NoneType if not set in the connector settings in Kibana Solutin: Validate that bother username and password are NOT of NoneType, instead of validating the len() of NoneType

Alternatives

Option 1:

Additional Context

navarone-feekery commented 11 months ago

Thanks for submitting this issue @dcampillo. Do you know what version connector you were running when you encountered this?

dcampillo commented 11 months ago

Hi,

This issue is present in version 8.10, 8.11 and 8.12. and probably all previous versions, I haven't checked.

David

artem-shelkovnikov commented 11 months ago

I double checked and the bug is only present in 8.10 - latest 8.11 and 8.12 don't have this problem.

@dcampillo can you verify that this problem does not happen on newer version of framework? Can you upgrade to 8.11/8.12 if it's working well?