-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Secret handling in OpenSearchDocumentStore #1288
base: main
Are you sure you want to change the base?
Conversation
This one is not ready yet @tstadel 👍 |
@tstadel should be ready now, please be really careful with this one 🙏 |
integrations/opensearch/src/haystack_integrations/document_stores/opensearch/document_store.py
Show resolved
Hide resolved
@vblagoje in general looks good. I'm very confident we don't break anything. But let's please support import yaml
serialized = OpenSearchDocumentStore().to_dict()
yaml_serialized = yaml.safe_dump(serialized)
yaml_deserialized = yaml.safe_load(yaml_serialized)
# http_auth will be [...] and hence secrets not deserialized
deserialzed = OpenSearchDocumentStore.from_dict(yaml_deserialized) |
…res/opensearch/document_store.py Co-authored-by: tstadel <[email protected]>
Why:
Enhances the authentication mechanism within the OpenSearch integration to allow for sensitive credentials to be managed securely using environment variables.
What:
username
andpassword
) from environment variables using theSecret
class.Secret
objects for secure storage and retrieval of credentials.How can it be used:
Environment variable-based authentication can be leveraged by setting:
Then, initialize the
OpenSearchDocumentStore
as follows:How did you test it:
Testing involved mocking the
OpenSearch
client to verify the correct behavior of the authentication logic, including the execution of environment variable-based initialization and validation of serialized objects to check the correct capture of credentials asSecret
dictionaries.Notes for the reviewer:
Focus on the sections handling the
http_auth
in dict serialization and the test cases for environment-based authentication to ensure consistent and secure handling of credentials. Verify that no credentials are logged or exposed improperly.