Skip to content

Fix: Docker connection issue in sandbox by binding to all interfaces#9977

Closed
dtometzki wants to merge 5 commits into
google-gemini:mainfrom
dtometzki:sandbox
Closed

Fix: Docker connection issue in sandbox by binding to all interfaces#9977
dtometzki wants to merge 5 commits into
google-gemini:mainfrom
dtometzki:sandbox

Conversation

@dtometzki

@dtometzki dtometzki commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

TLDR

The application port in the sandbox environment (Docker) couldn't be accessed by the IDE when listening on the loopback address (127.0.0.1). This patch updates the binding address from '127.0.0.1' to '0.0.0.0' to listen on all available network interfaces, ensuring connectivity with external processes like the IDE.

It doesnt work since git commit d746eb7 feat(vscode-ide-companion): harden ide-server with CORS and host validation (#8512

Damian

Dive Deeper

Reviewer Test Plan

Testing Matrix

🍏 🪟 🐧
npm run yes
npx
Docker yes
Podman - -
Seatbelt - -

Linked issues / bugs

image

@dtometzki dtometzki requested a review from a team as a code owner September 26, 2025 17:43
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @dtometzki, 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 addresses a critical connectivity problem in the Docker sandbox environment where the application was inaccessible to external tools like an IDE. By changing the network binding from the loopback address to all available interfaces, the application can now be properly reached, ensuring smoother development and testing workflows within containerized setups.

Highlights

  • Network Binding Change: The application's network binding in the Docker sandbox environment has been updated from '127.0.0.1' (loopback) to '0.0.0.0' (all interfaces).
  • Connectivity Fix: This change resolves an issue where external processes, such as an IDE, could not access the application port when running within a Docker container.
  • Host Header Validation Removal: A host header validation middleware that restricted connections to 'localhost' or '127.0.0.1' has been removed to accommodate the broader '0.0.0.0' binding.
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.

@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

The pull request correctly changes the server binding to 0.0.0.0 to support Docker environments. However, it introduces a critical security vulnerability by completely removing the Host header check. This exposes an unauthenticated endpoint to the local network, which could allow an attacker to perform actions in the user's IDE. I've suggested a way to mitigate this by re-introducing a more flexible host check.

@@ -159,18 +159,6 @@ export class IDEServer {
}),
);

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

Removing the host header check introduces a critical security vulnerability. By binding the server to 0.0.0.0, it becomes accessible from the local network. Without the host check, any device on the network can send requests to it. Although most requests require an auth token, initialize requests are unauthenticated for backward compatibility. This could allow an attacker on the same network to trigger actions in the IDE, such as opening a diff view with malicious content (openDiff tool), which poses a security risk.

I suggest re-introducing a host check that is flexible enough for the Docker use case. Checking just the hostname part of the Host header against a list of allowed hostnames like localhost and 127.0.0.1 would be much safer and should still work with Docker port forwarding.

      app.use((req, res, next) => {
        const hostname = (req.headers.host || '').split(':')[0];
        const allowedHostnames = [
          'localhost',
          '127.0.0.1',
        ];
        if (!allowedHostnames.includes(hostname)) {
          return res.status(403).json({ error: 'Invalid Host header' });
        }
        next();
      });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes it is correct but we are in a conflict here between header sec and sandbox env.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @chrstnb
who is responsible here ? I dont get any update since weeks

Damian

The application port in the sandbox environment (Docker) couldn't be accessed by the IDE when listening on the loopback address (127.0.0.1).
This patch updates the binding address from '127.0.0.1' to '0.0.0.0' to listen on all available network interfaces, ensuring connectivity with external processes like the IDE.

Damian
@dtometzki

Copy link
Copy Markdown
Contributor Author

Hi,

any update ?

Damian

@cornmander

Copy link
Copy Markdown
Contributor

We will review this this week. Thank you for your patience.

@cornmander cornmander self-requested a review November 3, 2025 14:23
@dtometzki

Copy link
Copy Markdown
Contributor Author

Hi @cornmander

any news to this pull request ?

Damian

@dtometzki

Copy link
Copy Markdown
Contributor Author

Hi @cornmander @chrstnb

any update on this. The issue was closed automaticly but wihout any response to this.

Damian

@gemini-cli gemini-cli Bot added the priority/p2 Important but can be addressed in a future release. label Jan 10, 2026
@bdmorgan

Copy link
Copy Markdown
Collaborator

Thank you for submission to the Gemini CLI project. At this time, we are closing this pull request in order to allow us to better triage and support more recent pull requests against the latest code changes. If you feel like this pull request is a critical contribution to the Gemini CLI project, please associate the pull request with an existing GitHub issue (instructions here: https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue) before reopening. After Monday January 26 2026, any pull requests submitted by contributors without an associated issue will be automatically closed (more information here: #16706). If you do choose to reopen and submit this pull request, please ensure you rebase your changes onto the current main branch before resubmitting. This will help avoid merge conflicts and ensure your contribution is compatible with the latest codebase.

@bdmorgan bdmorgan closed this Jan 23, 2026
@sripasg sripasg added the size/s A small PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p2 Important but can be addressed in a future release. size/s A small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ERROR] [IDEClient] Failed to connect to IDE companion extension for VS Code (in Cursor Dev Container)

4 participants