Skip to content

🔒 Fix hardcoded default passwords in pod.yaml#187

Merged
sheepdestroyer merged 5 commits into
masterfrom
security/fix-hardcoded-passwords-426555326241085988
Jul 1, 2026
Merged

🔒 Fix hardcoded default passwords in pod.yaml#187
sheepdestroyer merged 5 commits into
masterfrom
security/fix-hardcoded-passwords-426555326241085988

Conversation

@sheepdestroyer

@sheepdestroyer sheepdestroyer commented Jun 30, 2026

Copy link
Copy Markdown
Owner

🎯 What: Removed hardcoded credentials for Redis, Clickhouse, and Langfuse from pod.yaml and ensured they are generated securely via OpenSSL in start-stack.sh.

⚠️ Risk: Storing hardcoded passwords in configuration files is a major security vulnerability that could lead to unauthorized access to critical databases and user sessions.

🛡️ Solution: Substituted the hardcoded values with template placeholders (e.g., REDIS_AUTH_PLACEHOLDER, CLICKHOUSE_PASSWORD_PLACEHOLDER). Modified the deployment script start-stack.sh to generate random passwords during startup, save them securely to .env, and inject them into pod.yaml via Python script text substitution. Fixed a missing comma bug in the replacement script's list of placeholders.


PR created automatically by Jules for task 426555326241085988 started by @sheepdestroyer

Summary by Sourcery

Secure generated credentials for Redis and Clickhouse and wire them into pod.yaml via environment-driven template rendering.

New Features:

  • Generate random REDIS_AUTH and CLICKHOUSE_PASSWORD values at stack startup and persist them to the .env file.

Bug Fixes:

  • Fix the placeholder list in the pod.yaml rendering script by adding the missing comma and validating new Redis and Clickhouse placeholders are present.
  • Ensure pod.yaml uses templated placeholders instead of hardcoded Redis and Clickhouse passwords for containers and probes.

Enhancements:

  • Extend the pod.yaml rendering to export and substitute Redis and Clickhouse credentials from environment variables into the template.

Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@sourcery-ai

sourcery-ai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR removes hardcoded Redis and Clickhouse credentials from the pod definition and replaces them with runtime-generated secrets wired through the startup script and a Python-based template substitution step, also fixing a bug in the placeholder list used for validation.

Flow diagram for runtime generation and injection of Redis/Clickhouse credentials

flowchart TD
    A[start-stack.sh invoked] --> B[Check REDIS_AUTH env]
    B -->|unset| C[Generate REDIS_AUTH via openssl rand -hex 16]
    C --> D[Append REDIS_AUTH to .env]
    B -->|set| E[Skip REDIS_AUTH generation]

    A --> F[Check CLICKHOUSE_PASSWORD env]
    F -->|unset| G[Generate CLICKHOUSE_PASSWORD via openssl rand -hex 16]
    G --> H[Append CLICKHOUSE_PASSWORD to .env]
    F -->|set| I[Skip CLICKHOUSE_PASSWORD generation]

    A --> J[Call render_pod_yaml]
    J --> K[Python script loads pod.yaml template]
    K --> L[Validate placeholders list
ENCRYPTION_KEY_PLACEHOLDER
MINIO_PASSWORD_PLACEHOLDER
LANGFUSE_INIT_USER_PASSWORD_PLACEHOLDER
REDIS_AUTH_PLACEHOLDER
CLICKHOUSE_PASSWORD_PLACEHOLDER]
    L --> M[Substitute placeholders with env vars
REDIS_AUTH
CLICKHOUSE_PASSWORD]
    M --> N[Emit rendered pod.yaml for deployment]
Loading

File-Level Changes

Change Details Files
Generate Redis and Clickhouse passwords at startup and persist them into the environment file for reuse.
  • Add conditional generation of REDIS_AUTH using openssl rand -hex 16 when not already set.
  • Add conditional generation of CLICKHOUSE_PASSWORD using openssl rand -hex 16 when not already set.
  • Append generated REDIS_AUTH and CLICKHOUSE_PASSWORD values to the .env file with clear status messages.
start-stack.sh
Export new secret variables and extend the Python templating logic to validate and substitute the new placeholders, fixing a missing comma bug.
  • Add REDIS_AUTH and CLICKHOUSE_PASSWORD to the list of exported environment variables used by render_pod_yaml.
  • Fix the missing comma between MINIO_PASSWORD_PLACEHOLDER and LANGFUSE_INIT_USER_PASSWORD_PLACEHOLDER in the placeholders list.
  • Add REDIS_AUTH_PLACEHOLDER and CLICKHOUSE_PASSWORD_PLACEHOLDER to the placeholders validation list.
  • Add text replacement rules mapping the new placeholders to REDIS_AUTH and CLICKHOUSE_PASSWORD environment variables.
start-stack.sh
Replace hardcoded Redis and Clickhouse credentials in the pod specification with placeholders that will be filled in at render time.
  • Update CLICKHOUSE_PASSWORD environment variables and liveness probe arguments to use CLICKHOUSE_PASSWORD_PLACEHOLDER instead of the literal password.
  • Update Redis container command and health probe to use REDIS_AUTH_PLACEHOLDER instead of the literal password.
  • Update application containers’ CLICKHOUSE_PASSWORD and REDIS_AUTH environment variables to use the new placeholders.
pod.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@sheepdestroyer, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f3c6fbe1-e7e3-4cfd-a3b4-4d0aceb19c6c

📥 Commits

Reviewing files that changed from the base of the PR and between 2b8258e and 125cf3a.

📒 Files selected for processing (43)
  • .github/dependabot.yml
  • .github/workflows/test.yml
  • .gitignore
  • README.md
  • get_pr_status.py
  • host_agy_daemon.py
  • litellm/entrypoint.py
  • pod.yaml
  • router/main.py
  • router/test_memory_mcp.py
  • router/tests/test_agy_proxy.py
  • router/tests/test_dashboard_data.py
  • router/tests/test_detect_active_tool.py
  • router/tests/test_estimate_prompt_tokens.py
  • router/tests/test_load_persisted_stats.py
  • router/tests/test_memory_mcp.py
  • scripts/README.md
  • scripts/benchmark_tokens.py
  • start-stack.sh
  • sync_gemini_token.py
  • test_a2_verify.py
  • test_agy_behavior.py
  • test_agy_tiers.py
  • test_antigravity.py
  • test_atomic_write.py
  • test_check_http_endpoint.py
  • test_circuit_breaker.py
  • test_classifier_accuracy.py
  • test_compute_free_model_score.py
  • test_host_agy_daemon.py
  • test_map_tool_to_category.py
  • test_memory_mcp.py
  • test_models_proxy.py
  • test_pie_chart_gradient.py
  • test_quota_reset.sh
  • test_record_tool_usage.py
  • test_src_badge.py
  • test_stream_latency.py
  • test_sync_gemini_token.py
  • tests/test_host_agy_daemon.py
  • triage_upgrade_plan.md
  • verify_breaker.py
  • watch_quota.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch security/fix-hardcoded-passwords-426555326241085988

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The new REDIS_AUTH and CLICKHOUSE_PASSWORD generation blocks always append to .env when the variables are unset in the current shell; consider ensuring .env is sourced before these checks or updating existing keys in-place to avoid accumulating duplicate entries over repeated runs.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new REDIS_AUTH and CLICKHOUSE_PASSWORD generation blocks always append to .env when the variables are unset in the current shell; consider ensuring .env is sourced before these checks or updating existing keys in-place to avoid accumulating duplicate entries over repeated runs.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@sheepdestroyer

Copy link
Copy Markdown
Owner Author

@gemini review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@sheepdestroyer I'll review the changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 replaces hardcoded passwords and authentication tokens in pod.yaml with placeholders and updates start-stack.sh to dynamically generate and inject these values (such as REDIS_AUTH, CLICKHOUSE_PASSWORD, and LANGFUSE_INIT_USER_PASSWORD). However, several critical issues were identified in start-stack.sh: a missing comma in the Python placeholder list causes implicit string concatenation and validation failure; several newly added placeholders are missing from pod.yaml, which will crash the startup script; MINIO_ROOT_USER and MINIO_ROOT_PASSWORD are accessed but never defined or generated, leading to a potential KeyError; and the new variables generated via openssl are not accounted for in the script's pre-checks for openssl availability.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread start-stack.sh
Comment thread start-stack.sh
Comment on lines +451 to +454
"postgres-password-***",
"MINIO_USER_PLACEHOLDER",
"MINIO_PASSWORD_PLACEHOLDER",
"LANGFUSE_INIT_USER_PASSWORD_PLACEHOLDER",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

These newly added placeholders ("postgres-password-***", "MINIO_USER_PLACEHOLDER", "MINIO_PASSWORD_PLACEHOLDER", and "LANGFUSE_INIT_USER_PASSWORD_PLACEHOLDER") are not present in pod.yaml. Because of the strict validation loop on lines 461-464, the script will fail to start and exit with an error. To resolve this, either add these placeholders to pod.yaml (replacing the hardcoded values) or remove them from this list.

Comment thread start-stack.sh
Comment on lines +476 to +477
text = text.replace("MINIO_USER_PLACEHOLDER", os.environ["MINIO_ROOT_USER"])
text = text.replace("MINIO_PASSWORD_PLACEHOLDER", os.environ["MINIO_ROOT_PASSWORD"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The environment variables MINIO_ROOT_USER and MINIO_ROOT_PASSWORD are accessed from os.environ here, but they are not defined or generated anywhere in start-stack.sh. If they are not already set in the environment, this will raise a KeyError and crash the script. Consider generating them securely or defining default values in start-stack.sh if they are missing from .env.

Comment thread start-stack.sh
Comment on lines +159 to +175
if [ -z "$LANGFUSE_INIT_USER_PASSWORD" ]; then
LANGFUSE_INIT_USER_PASSWORD="$(openssl rand -hex 16)"
echo "LANGFUSE_INIT_USER_PASSWORD=\"$LANGFUSE_INIT_USER_PASSWORD\"" >> "$ENV_FILE"
echo "✓ Generated new LANGFUSE_INIT_USER_PASSWORD and saved to $ENV_FILE"
fi

if [ -z "$REDIS_AUTH" ]; then
REDIS_AUTH="$(openssl rand -hex 16)"
echo "REDIS_AUTH=\"$REDIS_AUTH\"" >> "$ENV_FILE"
echo "✓ Generated new REDIS_AUTH and saved to $ENV_FILE"
fi

if [ -z "$CLICKHOUSE_PASSWORD" ]; then
CLICKHOUSE_PASSWORD="$(openssl rand -hex 16)"
echo "CLICKHOUSE_PASSWORD=\"$CLICKHOUSE_PASSWORD\"" >> "$ENV_FILE"
echo "✓ Generated new CLICKHOUSE_PASSWORD and saved to $ENV_FILE"
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The script now generates LANGFUSE_INIT_USER_PASSWORD, REDIS_AUTH, and CLICKHOUSE_PASSWORD using openssl. However, these variables are not included in the pre-checks for openssl availability at the beginning of the script (lines 34 and 108). If any of these variables are missing from .env and openssl is not installed, the script will fail at runtime when trying to generate them. Please update the pre-checks to include these new variables.

sheepdestroyer and others added 2 commits July 1, 2026 11:36
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@sheepdestroyer

Copy link
Copy Markdown
Owner Author

@jules

  • There are unaddressed Reviews & Comments on this PR#
    Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate.
    Make sure you did not miss any reviews or comments.

Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant