fix(patch): cherry-pick 58df1c6 to release/v0.30.0-pr-20374 [CONFLICTS]#20567
Conversation
# Conflicts: # packages/core/src/tools/mcp-client.test.ts # packages/core/src/tools/mcp-client.ts
Summary of ChangesHello, 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 aims to deliver a critical patch release (v0.30.1) by cherry-picking a fix for environment variable loading in MCP servers. The core change enhances the system's ability to correctly process and expand environment variables from various sources, including extensions. However, the automated cherry-pick encountered merge conflicts, necessitating manual resolution to integrate these important stability improvements. Highlights
Changelog
Activity
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.
Code Review
This pull request appears to be a cherry-pick that has resulted in several unresolved merge conflicts. These conflicts are present in both the test file and the main source file, and will prevent the code from compiling or running correctly. It is critical to resolve these conflicts before merging. Additionally, ensure that environment variable expansion for HTTP headers and stdio-based MCP server configurations correctly utilizes sanitized environments as per repository guidelines.
| <<<<<<< HEAD | ||
| ======= | ||
| const extensionEnv = getExtensionEnvironment(mcpServerConfig.extension); | ||
| const expansionEnv = { ...process.env, ...extensionEnv }; | ||
|
|
||
| const sanitizedEnv = sanitizeEnvironment(expansionEnv, { | ||
| ...sanitizationConfig, | ||
| enableEnvironmentVariableRedaction: true, | ||
| }); | ||
|
|
||
| const expandedHeaders: Record<string, string> = {}; | ||
| if (mcpServerConfig.headers) { | ||
| for (const [key, value] of Object.entries(mcpServerConfig.headers)) { | ||
| expandedHeaders[key] = expandEnvVars(value, sanitizedEnv); | ||
| } | ||
| } | ||
|
|
||
| >>>>>>> 58df1c623 (Fix extension MCP server env var loading (#20374)) |
There was a problem hiding this comment.
This function contains unresolved merge conflict markers. After resolving them, please also note that expandedHeaders is calculated but not used in the return statement on line 759. The original mcpServerConfig.headers are used instead, which means the header values are not being expanded as intended. This is critical for ensuring that environment variables in HTTP headers are properly sanitized and expanded as per repository guidelines.
const extensionEnv = getExtensionEnvironment(mcpServerConfig.extension);
const expansionEnv = { ...process.env, ...extensionEnv };
const sanitizedEnv = sanitizeEnvironment(expansionEnv, {
...sanitizationConfig,
enableEnvironmentVariableRedaction: true,
});
const expandedHeaders: Record<string, string> = {};
if (mcpServerConfig.headers) {
for (const [key, value] of Object.entries(mcpServerConfig.headers)) {
expandedHeaders[key] = expandEnvVars(value, sanitizedEnv);
}
}References
- Sanitize the environment used for variable expansion in HTTP headers to prevent malicious extensions from exfiltrating sensitive system environment variables.
|
Size Change: +5.85 kB (+0.02%) Total Size: 24.5 MB
ℹ️ View Unchanged
|
This PR automatically cherry-picks commit 58df1c6 to patch version v0.30.0 in the stable release to create version 0.30.1.
This cherry-pick resulted in merge conflicts that need manual resolution.
🔧 Next Steps:
📋 Files with conflicts:
The commit has been created with conflict markers for easier manual resolution.
🚨 Important: