Skip to content

Conversation

@sestinj
Copy link
Contributor

@sestinj sestinj commented Nov 5, 2025

Summary by cubic

Pass all environment variables to MCP servers instead of only PATH to improve compatibility and reduce startup failures. We merge process.env into serverConfig.env, keep explicit overrides, and skip empty values.

Written for commit 1aa83f2. Summary will update automatically on new commits.

@sestinj sestinj requested a review from a team as a code owner November 5, 2025 16:41
@sestinj sestinj requested review from tingwai and removed request for a team November 5, 2025 16:41
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Nov 5, 2025
@sestinj sestinj merged commit e761b68 into main Nov 5, 2025
33 of 37 checks passed
@sestinj sestinj deleted the nate/mcp-inherit-all-env-vars branch November 5, 2025 16:41
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

⚠️ PR Title Format

Your PR title doesn't follow the conventional commit format, but this won't block your PR from being merged. We recommend using this format for better project organization.

Expected Format:

<type>[optional scope]: <description>

Examples:

  • feat: add changelog generation support
  • fix: resolve login redirect issue
  • docs: update README with new instructions
  • chore: update dependencies

Valid Types:

feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert

This helps with:

  • 📝 Automatic changelog generation
  • 🚀 Automated semantic versioning
  • 📊 Better project history tracking

This is a non-blocking warning - your PR can still be merged without fixing this.

@github-project-automation github-project-automation bot moved this from Todo to Done in Issues and PRs Nov 5, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="extensions/cli/src/services/MCPService.ts">

<violation number="1" location="extensions/cli/src/services/MCPService.ts:513">
This change introduces a severe security vulnerability. By passing all `process.env` variables to `StdioMcpServer` child processes, it allows potentially malicious configuration files (loaded via `--config`) to execute arbitrary commands with access to all secrets in the user&#39;s environment. The previous behavior of only passing `PATH` was safer. This change makes it possible for a malicious project to steal a user&#39;s API keys and other credentials.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

if (process.env.PATH !== undefined) {
env.PATH = process.env.PATH;
if (process.env) {
for (const [key, value] of Object.entries(process.env)) {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 5, 2025

Choose a reason for hiding this comment

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

This change introduces a severe security vulnerability. By passing all process.env variables to StdioMcpServer child processes, it allows potentially malicious configuration files (loaded via --config) to execute arbitrary commands with access to all secrets in the user's environment. The previous behavior of only passing PATH was safer. This change makes it possible for a malicious project to steal a user's API keys and other credentials.

Prompt for AI agents
Address the following comment on extensions/cli/src/services/MCPService.ts at line 513:

<comment>This change introduces a severe security vulnerability. By passing all `process.env` variables to `StdioMcpServer` child processes, it allows potentially malicious configuration files (loaded via `--config`) to execute arbitrary commands with access to all secrets in the user&#39;s environment. The previous behavior of only passing `PATH` was safer. This change makes it possible for a malicious project to steal a user&#39;s API keys and other credentials.</comment>

<file context>
@@ -509,8 +509,12 @@ export class MCPService
-    if (process.env.PATH !== undefined) {
-      env.PATH = process.env.PATH;
+    if (process.env) {
+      for (const [key, value] of Object.entries(process.env)) {
+        if (!(key in env) &amp;&amp; !!value) {
+          env[key] = value;
</file context>
Fix with Cubic

@sestinj
Copy link
Contributor Author

sestinj commented Nov 7, 2025

🎉 This PR is included in version 1.32.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor Author

sestinj commented Nov 18, 2025

🎉 This PR is included in version 1.29.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor Author

sestinj commented Nov 19, 2025

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor Author

sestinj commented Nov 20, 2025

🎉 This PR is included in version 1.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

released size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants