Skip to content

Keep Valkey credentials out of the MCP child and collector logs - #602

Merged
nassery318 merged 2 commits into
mainfrom
fix/credential-exposure
Nov 27, 2026
Merged

nassery318 merged 2 commits into
mainfrom
fix/credential-exposure

Conversation

@nassery318

Copy link
Copy Markdown
Contributor

Description

Fixes two ways Valkey credentials could leak.

MCP: the server passed its VALKEY_USERNAME and VALKEY_PASSWORD to the MCP child. On a loopback server with no MCP token, any local process could read Valkey as the preconfigured user without knowing the password. The child no longer receives these variables.

Metrics: when Hot Keys failed to authenticate (for example after a password rotation), the collector logged the whole iovalkey error. That error includes the AUTH arguments, so the password ended up in the server log every cycle. The collector now logs only err.message.

Testing

  • MCP: confirmed in code that the child no longer gets the credentials
  • Metrics: rejected AUTH against a test server and rotated the password with Hot Keys running; the log no longer shows the password

Signed-off-by: nassery318 <nassery318@gmail.com>
@github-actions
github-actions Bot requested a review from ArgusLi November 26, 2026 20:29
@github-actions github-actions Bot added area/server Backend, WebSocket, actions area/metrics Metrics collection, NDJSON, analyzers labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The MCP child process no longer inherits VALKEY_USERNAME or VALKEY_PASSWORD. Metrics error logs now output error messages instead of error objects.

Changes: MCP environment filtering

Layer / File(s) Summary
Filter the MCP child environment
apps/server/src/mcp-process.ts, apps/mcp/README.md
The child process environment excludes inherited VALKEY_USERNAME and VALKEY_PASSWORD. The README documents that VALKEY_HOST, VALKEY_PORT, and VALKEY_TLS are inherited, but credentials are not. It also states that requests without connection headers use no inherited credentials.

Metrics error logging

Layer / File(s) Summary
Log metrics error messages
apps/metrics/src/effects/monitor-stream.js, apps/metrics/src/init-collectors.js, apps/metrics/src/handlers/monitor-handler.js, apps/metrics/src/handlers/commandlog-handler.js, apps/metrics/src/analyzers/get-hot-slots.js
Error logs now output the caught error’s message. Existing return behavior is unchanged.

Change: Bug fix

Merge Risk: Minimal · up to db834

This change stops Valkey credentials from reaching the MCP child process and keeps them out of metrics error logs. No merge-blocking risk was identified. Requests to the MCP server without connection headers now connect without credentials, which is the documented and intended behavior.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Valkey credentials are kept out of the MCP child process and the collector logs. The changeset removes VALKEY_USERNAME and VALKEY_PASSWORD from the MCP child environme…
Description check Passed The description follows the repository template's core section. It has a Description section that summarizes the change clearly, explaining the MCP credential inheritance leak and the metrics logging …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Valkey credentials are kept out of the MCP child process and the collector logs. The changeset removes VALKEY_USERNAME and VALKEY_PASSWORD from the MCP child environment and logs only err.message in metrics handlers, so the title matches the primary change. It is specific and under the usual length. It does not name the MCP environment change directly, but it covers both halves of the change.

Full details: Description check

Explanation

The description follows the repository template's core section. It has a Description section that summarizes the change clearly, explaining the MCP credential inheritance leak and the metrics logging leak with the reasons for each fix. It also includes a Testing section. The template's Change Visualization section is missing. For a change that only alters logging and environment handling, a screenshot or video is not practical, but the author should still add the heading and state that no visual change applies.

Resolution

Add a Change Visualization heading to the description. State that the change has no visual output, or add before and after log output as text if that helps reviewers.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 62db47de-107e-4a07-b813-d715955b6b10
Commits

Reviewing files that changed from the base of the PR and between f3c6531 and db834f6.

Files selected for processing: 1

  • apps/metrics/src/handlers/commandlog-handler.js
Files skipped from review as they are similar to previous changes: 1

  • apps/metrics/src/handlers/commandlog-handler.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Signed-off-by: nassery318 <nassery318@gmail.com>
@nassery318
nassery318 merged commit c0026e6 into main Nov 27, 2026
10 checks passed
@ArgusLi
ArgusLi deleted the fix/credential-exposure branch November 27, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/metrics Metrics collection, NDJSON, analyzers area/server Backend, WebSocket, actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants