jakub-sandomierz-deepsense-ai 0ca154a0f3
Fix: MongoDB connector URI password redaction, basic unit tests for Git connector (#2268)
MongoDB connector:
Issue:
[MongoDB
documentation](https://www.mongodb.com/docs/manual/reference/connection-string/)
states that characters `$ : / ? # [ ] @` must be percent encoded. URI
with password containing such special character will not be redacted.

Fix:
This fix removes usage of `unquote_plus` on password which allows
detected password to match with one inside URI and successfully replace
it.

Git connector:
Added very basic unit tests for repository filtering methods. Their
impact is rather minimal but showcases current limitation in
`is_file_type_supported` method.
2024-01-08 11:27:08 +00:00

17 lines
539 B
Python

from unstructured.ingest.cli.common import options_redactions
def test_options_redactions():
given_options = {
"uri": "mongodb+srv://myDatabaseUser:D1fficultP%40ssw0rd@mongodb0.example.com/"
"?authSource=admin&replicaSet=myRepl"
}
when_options = options_redactions(options=given_options)
assert given_options["uri"] != when_options["uri"]
assert (
when_options["uri"] == "mongodb+srv://myDatabaseUser:***REDACTED***@mongodb0.example.com/"
"?authSource=admin&replicaSet=myRepl"
)