Skip to content

fix(cli): allow installing extensions from ssh repo#26274

Open
danielmundi wants to merge 1 commit intogoogle-gemini:mainfrom
danielmundi:extensions-install-ssh
Open

fix(cli): allow installing extensions from ssh repo#26274
danielmundi wants to merge 1 commit intogoogle-gemini:mainfrom
danielmundi:extensions-install-ssh

Conversation

@danielmundi
Copy link
Copy Markdown

Current code doesn't allow installing extensios from an URL with ssh:// prefix.
Update the filter to include this prefix option.

Summary

Allow installing extensions from Git repositories that have the URL using the ssh:// prefix.

Details

Some repositories don't accept the github and gitlab URL patterns and instead use the URL as ssh://url.domain.com. It should be possible to install from those Git repositories as well.

Related Issues

Fixes #26273

How to Validate

Execute command to install extension using an URL with ssh:// prefix, such as:

gemini extensions install ssh://url.domain.com

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

Current code doesn't allow installing extensios from an URL with
`ssh://` prefix.
Update the filter to include this prefix option.

Signed-off-by: Daniel Finimundi <danielrf@motorola.com>
@danielmundi danielmundi requested a review from a team as a code owner April 30, 2026 17:53
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 improves the CLI's flexibility by enabling support for SSH-based Git repository URLs during the extension installation process. This ensures that users can install extensions from a wider range of repository hosting configurations that utilize the ssh:// protocol.

Highlights

  • Extension Installation: Updated the extension manager to support installing extensions from Git repositories using the ssh:// URL prefix.
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.

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.

Copy link
Copy Markdown
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 adds support for the ssh:// protocol when inferring extension installation metadata. Feedback suggests expanding this to include git+ssh:// for better coverage. There is also a concern regarding potential failures in existing security checks that use filesystem-based path resolution on these remote URLs, which could lead to extensions being blocked incorrectly.

Comment on lines +1303 to +1304
source.startsWith('gitlab:') ||
source.startsWith('ssh://')
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.

security-high high

While adding ssh:// support is correct, consider also including the git+ssh:// prefix to provide more comprehensive support for common Git protocols. Many hosting services and package managers use git+ssh:// for secure access.

Security Note: Please be aware that the allowedExtensions security check (at lines 188 and 730) currently calls getRealPath() on the source string. Since ssh:// (and other remote protocols) are URLs rather than filesystem paths, getRealPath will likely throw an error if allowedExtensions is configured in the settings. This would prevent the installation or loading of remote extensions when security restrictions are enabled. This should be addressed in a follow-up to ensure the allowlist validation works correctly for URLs, while maintaining a 'fail-closed' approach as per repository standards.

    source.startsWith('gitlab:') ||
    source.startsWith('ssh://') ||
    source.startsWith('git+ssh://')
References
  1. Security checks, such as an extension allowlist, should be implemented in a 'fail-closed' manner. If an item's validity cannot be verified (e.g., due to missing metadata), it should be rejected by default.

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.

Could you please address this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This GCA comment is not correct. The getRealPath() function does not work well with any of the URL, including "github:" and "git@", it treats them as relative paths and just appends the CWD path to transform it in an absolute path. As an example, installing the Google Workspace extension "https:/github.com/gemini-cli-extensions/workspace", from the user's home, the getRealPath() would return /home/daniel/https:/github.com/gemini-cli-extensions/workspace.
The regex comparison on installOrUpdateExtension() still work, because the path is still there, but using https://, github:, git@ or ssh:// doesn't change this behavior.

I also don't know of any place that uses git+ssh://, so I'd rather not include it here. There is no security advantage of using this prefix, it's just an indication to help some tools confirm the URL is a git repository, which is not the case for gemini-cli.

Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request May 1, 2026
- BerriAI/litellm#26969: tool-permission guardrail tightening (merge-after-nits)
- BerriAI/litellm#26967: VCR Redis observability (merge-as-is)
- google-gemini/gemini-cli#26303: brain/critique role split + iteration (needs-discussion)
- google-gemini/gemini-cli#26287: voice transcription cursor-position insert (merge-after-nits)
- google-gemini/gemini-cli#26274: ssh:// extension install scheme (merge-as-is)
@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli Bot commented May 7, 2026

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/extensions Issues related to Gemini CLI extensions capability help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels May 7, 2026
Comment on lines +1303 to +1304
source.startsWith('gitlab:') ||
source.startsWith('ssh://')
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.

Could you please address this

@danielmundi
Copy link
Copy Markdown
Author

danielmundi commented May 9, 2026

I agree with the author's assessment regarding both getRealPath and git+ssh://.

  1. getRealPath: As pointed out, the current implementation of getRealPath handles all remote URLs (including https://, github:, etc.) by falling back to path.resolve(). This effectively prepends the CWD to the URL string but doesn't throw an error. While this behavior isn't ideal for URLs, it means the regex checks in allowedExtensions still function as before because the original URL string is preserved within the mangled path. Adding ssh:// introduces no new regressions here. Any refactoring of how remote URLs are handled in security checks should be tracked as a separate issue.
  2. git+ssh://: Adding support for git+ssh:// is unnecessary unless there's a specific, reported use case for it within the context of Gemini CLI extension installation. Keeping the supported prefixes strict is the right approach.

The PR's current implementation for ssh:// is safe and consistent with existing logic.

Edit: This is the Gemini review with ./script/review.sh 26274

@TrueAlpha-spiral
Copy link
Copy Markdown

TrueAlpha-spiral commented May 9, 2026 via email

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

Labels

area/extensions Issues related to Gemini CLI extensions capability help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p2 Important but can be addressed in a future release. status/pr-nudge-sent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gemini Extension can't be installed from ssh repository

3 participants