-
-
Notifications
You must be signed in to change notification settings - Fork 269
Add Memgraph authentication support #160
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
base: main
Are you sure you want to change the base?
Conversation
qdrddr
commented
Nov 17, 2025
- Add MEMGRAPH_USERNAME and MEMGRAPH_PASSWORD environment variables
- Update MemgraphIngestor to accept optional username/password parameters
- Pass credentials to all Memgraph connections throughout the codebase
- Update configuration files to support authenticated connections
- Add MEMGRAPH_USERNAME and MEMGRAPH_PASSWORD environment variables - Update MemgraphIngestor to accept optional username/password parameters - Pass credentials to all Memgraph connections throughout the codebase - Update configuration files to support authenticated connections
Summary of ChangesHello @qdrddr, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive support for Memgraph database authentication. It enables users to secure their Memgraph connections by providing a username and password via environment variables. The changes propagate these credentials through the application's configuration and ensure that all interactions with the Memgraph database are made using the specified authentication details, thereby enhancing the overall security posture of the application. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds authentication support for Memgraph, which is a great enhancement. The implementation is mostly correct, but there's a critical issue: the mgclient.connect function expects a user parameter, but username is used instead throughout the codebase. This will cause authentication to fail. I've left comments in all affected files to correct this, suggesting a rename of the parameter and related configuration variables to user for consistency. I've also suggested adding validation to ensure that if a password is provided, a user is also provided.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
256132e to
a6c22b0
Compare
- Update MemgraphIngestor to conditionally include auth parameters - Only add username/password to connection if username is provided - Allows connection to both authenticated and non-authenticated Memgraph instances - Add documentation to .env.example explaining authentication configuration
vitali87
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good feature addition. One inconsistency to address:
The .env.example comment states:
"If authentication is enabled, provide both username and password"
But the code allows username without password:
if self._username:
connect_params["username"] = self._username
connect_params["password"] = self._password if self._password else "" # allows emptyMeanwhile, password without username raises an error.
Please either:
- Add validation to require both when either is provided, OR
- Update the comment to indicate password is optional
vitali87
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good feature addition. One inconsistency to address:
The .env.example comment states:
"If authentication is enabled, provide both username and password"
But the code allows username without password:
if self._username:
connect_params["username"] = self._username
connect_params["password"] = self._password if self._password else "" # allows emptyMeanwhile, password without username raises an error.
Please either:
- Add validation to require both when either is provided, OR
- Update the comment to indicate password is optional
|
@qdrddr please address the comments above |
|
@vitali87 the memgraph auth, if enabled require both username & password to be set. |
vitali87
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
This PR is cleaner than the others - nice work on the validation logic.
Just a few adjustments needed to align with CONTRIBUTING.md:
- Remove inline comments (or prefix with
(H)if truly necessary) - Rebase on latest main
- Install pre-commit hooks:
pre-commit install
Alternatively, I can make these adjustments myself and merge with attribution to you.
Let me know!