Skip to content

Add extensionRegistryURI setting to change where the registry is read from#20463

Open
kevinjwang1 wants to merge 4 commits intogoogle-gemini:mainfrom
kevinjwang1:addRegistrySetting
Open

Add extensionRegistryURI setting to change where the registry is read from#20463
kevinjwang1 wants to merge 4 commits intogoogle-gemini:mainfrom
kevinjwang1:addRegistrySetting

Conversation

@kevinjwang1
Copy link
Contributor

@kevinjwang1 kevinjwang1 commented Feb 26, 2026

Summary

Add a new experimental setting called extensionRegistryURI to allow users to modify where the extension registry is read from. If unset, the default gemini cli registry is used.

Related Issues

Fixes https://github.com/google-gemini/maintainers-gemini-cli/issues/1404

@kevinjwang1 kevinjwang1 requested review from a team as code owners February 26, 2026 18:10
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kevinjwang1, 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 enhances the flexibility of extension management within the CLI by introducing a new experimental configuration setting. Users can now define a custom URI for the extension registry, which can point to either a web-based JSON file or a local file on their system. This change allows for greater control over where extension definitions are sourced, supporting custom or offline extension scenarios.

Highlights

  • New Configuration Setting: Introduced a new experimental setting, experimental.extensionRegistryURI, allowing users to specify a custom URI (web URL or local file path) for the extension registry. This setting defaults to https://geminicli.com/extensions.json and requires a restart to take effect.
  • Flexible Extension Registry Source: The ExtensionRegistryClient has been updated to support fetching extension lists from both HTTP/HTTPS URLs and local file paths, including file:// URIs. This provides greater flexibility for managing extensions.
  • Configuration Integration: The new extensionRegistryURI setting is integrated into the CLI's configuration loading process, ensuring that the specified registry URI is used when initializing the extension registry client. Path resolution is handled for local file paths.
  • UI and Schema Updates: The user interface components and configuration schemas have been updated to reflect and utilize the new extensionRegistryURI setting, ensuring it is properly documented and accessible.
Changelog
  • docs/reference/configuration.md
    • Documented the new experimental.extensionRegistryURI setting, including its description, default value, and restart requirement.
  • packages/cli/src/config/config.ts
    • Imported path and resolveToRealPath for file path handling.
    • Added logic to resolve extensionRegistryURI to a real path if it's a local file path.
    • Passed the resolved extensionRegistryURI to the Config constructor.
  • packages/cli/src/config/extensionRegistryClient.test.ts
    • Mocked node:fs/promises to simulate file system operations.
    • Added new test cases to verify fetching extensions from local file paths and file:// URIs.
  • packages/cli/src/config/extensionRegistryClient.ts
    • Imported fs from node:fs/promises and resolveToRealPath.
    • Modified the ExtensionRegistryClient constructor to accept an optional registryURI, defaulting to the standard URL.
    • Updated the getExtensions method to conditionally fetch from HTTP/HTTPS or read from a local file based on the registryURI scheme.
  • packages/cli/src/config/settingsSchema.ts
    • Added the extensionRegistryURI property to the experimental section of the settings schema, defining its type, label, category, default, and description.
  • packages/cli/src/ui/components/views/ExtensionRegistryView.test.tsx
    • Updated the useConfig mock to include a mock implementation for getExtensionRegistryURI.
  • packages/cli/src/ui/components/views/ExtensionRegistryView.tsx
    • Modified the ExtensionRegistryView to retrieve the extensionRegistryURI from the useConfig hook.
    • Passed the retrieved extensionRegistryURI to the useExtensionRegistry hook.
  • packages/cli/src/ui/hooks/useExtensionRegistry.ts
    • Updated the useExtensionRegistry hook to accept an optional registryURI parameter.
    • Modified the ExtensionRegistryClient instantiation within useMemo to use the provided registryURI, ensuring the client is re-created when the URI changes.
  • packages/core/src/config/config.ts
    • Added extensionRegistryURI as an optional property to the ConfigParameters interface.
    • Declared extensionRegistryURI as a private readonly property in the Config class.
    • Initialized extensionRegistryURI in the Config constructor.
    • Added a public getter method getExtensionRegistryURI to the Config class.
  • schemas/settings.schema.json
    • Added the extensionRegistryURI property to the experimental section of the JSON schema, including its title, description, markdown description, default value, and type.
Activity
  • The pull request addresses and fixes issue Prerelease: Cleanup #1404, which likely requested the ability to customize the extension registry source.
  • No other specific human activity (comments, reviews, or progress updates) has been noted in the provided context.
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.

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 introduces a new experimental setting extensionRegistryURI to allow users to specify a custom source for the extension registry. However, this setting is vulnerable to hijacking via workspace-level configuration, which could lead to Path Traversal and SSRF vulnerabilities, allowing attackers to read sensitive local files or trick users into installing malicious extensions. Additionally, a critical caching issue in the ExtensionRegistryClient could lead to incorrect data being displayed when the registry URI is changed. It is recommended to guard the setting with a workspace trust check, validate the URI to prevent access to internal network resources, and address the caching problem.

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant