-
Notifications
You must be signed in to change notification settings - Fork 115
Set the embeddings server url for CDC mixer #5906
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: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @clincoln8, 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 enhances the 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 aims to add a conditional command-line argument --embeddings_server_url to the mixer command based on the ENABLE_MODEL environment variable. However, a high-severity command injection vulnerability has been identified in the build/cdc_services/run.sh script. The introduction of the $MIXER_ARGS variable without proper shell quoting, along with existing unquoted variables, creates a risk of arbitrary command execution. A more robust approach using a bash array for handling optional arguments is suggested to improve maintainability and mitigate word splitting issues.
| --cloudsql_instance=$CLOUDSQL_INSTANCE \ | ||
| --remote_mixer_domain=$DC_API_ROOT & | ||
| --remote_mixer_domain=$DC_API_ROOT \ | ||
| $MIXER_ARGS & |
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.
This line introduces a high-severity command injection vulnerability due to the unquoted shell variable $MIXER_ARGS. Unquoted variables can lead to word splitting and arbitrary command execution if an attacker controls environment variables, continuing an insecure pattern with other unquoted variables like $DC_API_ROOT and $CLOUDSQL_INSTANCE. To prevent this and ensure secure argument handling, it is critical to double-quote $MIXER_ARGS (e.g., "$MIXER_ARGS"). If $MIXER_ARGS is intended to be an array of arguments, then "${MIXER_ARGS[@]}" would be the correct and secure way to expand it, ensuring each argument is passed as a separate word. Always double-quote variables in commands as a security best practice.
| $MIXER_ARGS & | |
| "$MIXER_ARGS" & |
| MIXER_ARGS="" | ||
| if [[ $ENABLE_MODEL == "true" ]]; then | ||
| MIXER_ARGS="--embeddings_server_url=localhost:6060" | ||
| fi |
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.
For better robustness and to avoid issues with word splitting, it's recommended to use an array for storing optional command-line arguments in bash. This is safer if arguments with spaces are ever needed in the future. This change should be made in conjunction with updating how MIXER_ARGS is used on line 76.
| MIXER_ARGS="" | |
| if [[ $ENABLE_MODEL == "true" ]]; then | |
| MIXER_ARGS="--embeddings_server_url=localhost:6060" | |
| fi | |
| MIXER_ARGS=() | |
| if [[ $ENABLE_MODEL == "true" ]]; then | |
| MIXER_ARGS+=(--embeddings_server_url=localhost:6060) | |
| fi |
No description provided.