Skip to content

Comments

Revert unintended credentials exposure#18840

Merged
skeshive merged 1 commit intomainfrom
adibakm/revert-unintended-creds-exposure
Feb 11, 2026
Merged

Revert unintended credentials exposure#18840
skeshive merged 1 commit intomainfrom
adibakm/revert-unintended-creds-exposure

Conversation

@Adib234
Copy link
Contributor

@Adib234 Adib234 commented Feb 11, 2026

Summary

Reverts #17311

Details

Related Issues

How to Validate

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@Adib234 Adib234 self-assigned this Feb 11, 2026
@Adib234 Adib234 requested review from a team as code owners February 11, 2026 19:51
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Feb 11, 2026

Hi @Adib234, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Adib234, 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 reverts previous changes related to environment variable sanitization and redaction for MCP servers. The primary impact is that certain sensitive API keys will no longer be automatically redacted when spawning MCP servers, and the associated security warnings and documentation have been removed. This streamlines the environment configuration but shifts the responsibility for sensitive variable handling more directly to the user.

Highlights

  • Environment Variable Redaction Removed: The automatic redaction of sensitive environment variables, including GEMINI_API_KEY, GOOGLE_API_KEY, and GOOGLE_APPLICATION_CREDENTIALS, has been removed from the MCP server environment sanitization process.
  • Security Warnings and Documentation Updated: Related security warnings in the CLI's mcp add command and documentation regarding environment variable handling and untrusted servers have been removed.
  • Extension Environment Handling Simplified: The logic for incorporating extension-specific environment variables into MCP server processes has been removed, simplifying the environment setup.
  • Test Cases Removed/Modified: Corresponding test cases for sensitive environment variable redaction and extension environment inclusion have been removed or updated to reflect these changes.
Changelog
  • docs/tools/mcp-server.md
    • Removed security recommendations and warnings related to environment variable redaction and untrusted servers.
  • packages/cli/src/commands/mcp/add.ts
    • Removed a security warning log displayed when running MCP servers with stdio transport.
  • packages/core/src/services/environmentSanitization.test.ts
    • Removed test cases specifically checking the redaction of GEMINI_API_KEY, GOOGLE_API_KEY, and GOOGLE_APPLICATION_CREDENTIALS.
  • packages/core/src/services/environmentSanitization.ts
    • Removed GEMINI_API_KEY, GOOGLE_API_KEY, and GOOGLE_APPLICATION_CREDENTIALS from the list of NEVER_ALLOWED_ENVIRONMENT_VARIABLES.
  • packages/core/src/tools/mcp-client.test.ts
    • Updated an environment variable name in a test case from GEMINI_CLI_FOO to FOO.
    • Removed test cases for redacting sensitive environment variables and including extension settings in the environment.
  • packages/core/src/tools/mcp-client.ts
    • Removed the import for GeminiCLIExtension.
    • Simplified the environment variable construction for StdioClientTransport by removing explicit extension environment handling and the enableEnvironmentVariableRedaction flag.
    • Removed the getExtensionEnvironment helper function.
Activity
  • The pull request description contains a standard template, indicating no specific human activity or comments have been added yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Adib234 Adib234 changed the title revert Revert unintended credentials exposure Feb 11, 2026
@github-actions
Copy link

Size Change: -1.07 kB (0%)

Total Size: 24.3 MB

Filename Size Change
./bundle/gemini.js 24.3 MB -1.07 kB (0%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

@gemini-cli gemini-cli bot added the priority/p1 Important and should be addressed in the near term. label Feb 11, 2026
@skeshive skeshive enabled auto-merge February 11, 2026 20:01
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 reverts several security-related features concerning MCP server integration, specifically removing the automatic redaction of sensitive environment variables (like API keys) for stdio transports, deleting security warnings, and removing related security documentation. These changes introduce a critical security vulnerability, potentially leading to credential leakage to MCP server subprocesses. I strongly advise against merging this PR in its current state.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/core/src/services/environmentSanitization.ts (106-108)

critical

These environment variables should not be removed from the denylist. Removing them introduces a critical security vulnerability by allowing sensitive credentials like API keys to be leaked to MCP server subprocesses. Please revert this part of the change.

packages/core/src/tools/mcp-client.ts (1901-1904)

critical

This change introduces two critical security issues. First, it makes environment variable redaction opt-in (defaulting to false) instead of forcing it on for stdio transports. Second, it applies mcpServerConfig.env after sanitization, allowing these user-provided variables to bypass security checks entirely. This could lead to credential leakage. The environment for the subprocess should be constructed from all sources and then sanitized as a whole.

      env: sanitizeEnvironment(
        {
          ...process.env,
          ...(mcpServerConfig.env || {}),
        },
        {
          ...sanitizationConfig,
          enableEnvironmentVariableRedaction: true,
        },
      ) as Record<string, string>,

docs/tools/mcp-server.md (742-756)

high

This change removes crucial security documentation about environment variable redaction, explicit environment variable passing, and the risks of untrusted servers. This information is vital for users to securely configure and use MCP servers. Please restore these sections to ensure users are aware of the potential security implications.

packages/cli/src/commands/mcp/add.ts (131-136)

high

Removing this security warning is a regression in user security awareness. Users should be explicitly warned about the risks of running stdio MCP servers, as they can inherit and potentially expose sensitive environment variables. Please restore this warning.

@skeshive skeshive added this pull request to the merge queue Feb 11, 2026
Merged via the queue into main with commit e9a9474 Feb 11, 2026
30 of 31 checks passed
@skeshive skeshive deleted the adibakm/revert-unintended-creds-exposure branch February 11, 2026 20:23
@skeshive
Copy link
Contributor

/patch preview

@github-actions
Copy link

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: preview
  • Commit: e9a94748107ac24a05f51b4c5b0c0a8952374285
  • Workflows Created: 1

🔗 Track Progress:

@github-actions
Copy link

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. Review and approve the hotfix PR: #18841
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions
Copy link

🚀 Patch Release Started!

📋 Release Details:

  • Environment: prod
  • Channel: preview → publishing to npm tag preview
  • Version: v0.29.0-preview.0
  • Hotfix PR: Merged ✅
  • Release Branch: release/v0.29.0-preview.0-pr-18840

⏳ Status: The patch release is now running. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions
Copy link

Patch Release Failed!

📋 Details:

  • Version: 0.29.0-preview.1
  • Channel: preview
  • Error: The patch release workflow encountered an error

🔍 Next Steps:

  1. Check the workflow logs for detailed error information
  2. The maintainers have been notified via automatic issue creation
  3. You may need to retry the patch once the issue is resolved

🔗 Troubleshooting:

@skeshive
Copy link
Contributor

/patch stable

@github-actions
Copy link

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: stable
  • Commit: e9a94748107ac24a05f51b4c5b0c0a8952374285
  • Workflows Created: 1

🔗 Track Progress:

github-actions bot pushed a commit that referenced this pull request Feb 11, 2026
# Conflicts:
#	packages/core/src/tools/mcp-client.ts
@github-actions
Copy link

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. ⚠️ Resolve conflicts in the hotfix PR first: #18847
  2. Test your changes after resolving conflicts
  3. Once merged, the patch release will automatically trigger
  4. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions
Copy link

🚀 Patch Release Started!

📋 Release Details:

  • Environment: prod
  • Channel: stable → publishing to npm tag latest
  • Version: v0.28.1
  • Hotfix PR: Merged ✅
  • Release Branch: release/v0.28.1-pr-18840

⏳ Status: The patch release is now running. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions
Copy link

Patch Release Complete!

📦 Release Details:

  • Version: 0.28.2
  • NPM Tag: latest
  • Channel: stable
  • Dry Run: false

🎉 Status: Your patch has been successfully released and published to npm!

📝 What's Available:

🔗 Links:

krsjenmt added a commit to krsjenmt/gemini-cli that referenced this pull request Feb 12, 2026
…ini/gemini-cli (#37)

* fix(cli): resolve double rendering in shpool and address vscode lint warnings (google-gemini#18704)

* feat(plan): document and validate Plan Mode policy overrides (google-gemini#18825)

* Fix pressing any key to exit select mode. (google-gemini#18421)

* fix(cli): update F12 behavior to only open drawer if browser fails (google-gemini#18829)

* feat(plan): allow skills to be enabled in plan mode (google-gemini#18817)

Co-authored-by: Jerop Kipruto <jerop@google.com>

* docs(plan): add documentation for plan mode tools (google-gemini#18827)

* Remove experimental note in extension settings docs (google-gemini#18822)

* Update prompt and grep tool definition to limit context size (google-gemini#18780)

* docs(plan): add `ask_user` tool documentation (google-gemini#18830)

* Revert unintended credentials exposure (google-gemini#18840)

* feat(core): update internal utility models to Gemini 3 (google-gemini#18773)

* feat(a2a): add value-resolver for auth credential resolution (google-gemini#18653)

* Removed getPlainTextLength (google-gemini#18848)

* More grep prompt tweaks (google-gemini#18846)

* refactor(cli): Reactive useSettingsStore hook (google-gemini#14915)

* fix(mcp): Ensure that stdio MCP server execution has the `GEMINI_CLI=1` env variable populated. (google-gemini#18832)

* fix(core): improve headless mode detection for flags and query args (google-gemini#18855)

* refactor(cli): simplify UI and remove legacy inline tool confirmation logic (google-gemini#18566)

* feat(cli): deprecate --allowed-tools and excludeTools in favor of policy engine (google-gemini#18508)

* fix(workflows): improve maintainer detection for automated PR actions (google-gemini#18869)

* refactor(cli): consolidate useToolScheduler and delete legacy implementation (google-gemini#18567)

* Update changelog for v0.28.0 and v0.29.0-preview0 (google-gemini#18819)

* fix(core): ensure sub-agents are registered regardless of tools.allowed (google-gemini#18870)

---------

Co-authored-by: Brad Dux <959674+braddux@users.noreply.github.com>
Co-authored-by: Jerop Kipruto <jerop@google.com>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Sandy Tao <sandytao520@icloud.com>
Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
Co-authored-by: christine betts <chrstn@uw.edu>
Co-authored-by: Christian Gunderman <gundermanc@gmail.com>
Co-authored-by: Adam Weidman <65992621+adamfweidman@users.noreply.github.com>
Co-authored-by: Dev Randalpura <devrandalpura@google.com>
Co-authored-by: Pyush Sinha <pyushsinha20@gmail.com>
Co-authored-by: Richie Foreman <richie.foreman@gmail.com>
Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
Co-authored-by: Abhijit Balaji <abhijitbalaji@google.com>
Co-authored-by: Bryan Morgan <bryanmorgan@google.com>
Co-authored-by: g-samroberts <158088236+g-samroberts@users.noreply.github.com>
Co-authored-by: matt korwel <matt.korwel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants