feat(acp): Add support for AI Gateway auth#21305
Conversation
|
Hi @skeshive, 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! |
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 introduces a new authentication method, Highlights
Changelog
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
|
|
Size Change: +1.58 kB (+0.01%) Total Size: 26 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new AuthType.GATEWAY authentication method, enabling the use of a custom AI API Gateway with configurable baseUrl and customHeaders. The changes involve updating the GeminiAgent to store and pass these new gateway parameters to the refreshAuth and createContentGeneratorConfig functions, which in turn use them to configure the content generator. New test cases were added to verify the gateway authentication flow. However, a review comment raises a critical security concern, noting that the authenticate method extracts baseUrl and headers from the request's _meta.gateway without sufficient validation. This lack of validation could lead to credential leakage or the overriding of sensitive authentication headers. The reviewer recommends implementing strict validation for baseUrl (e.g., enforcing HTTPS, allow-listing), filtering headers to prevent sensitive overrides, and throwing an error for malformed gateway metadata instead of silently failing.
|
Thanks for putting this together! This is a great addition for supporting AI Gateways. I've reviewed the PR against our architectural guidelines and have a few requested changes, particularly around how the new authentication state is persisted and validated: 1. 🚨 Terminal UX Bleed (Major Bug)In this.settings.setValue(
SettingScope.User,
'security.auth.selectedType',
method,
);Because 2. 🛡️ Security & Validation (Silent Failures)Echoing the automated reviewer, if 3. 🧹 Method Signature Creep (
|
For 1) This only applies to ACP usage so not a big concern |
|
/patch preview |
|
✅ Patch workflow(s) dispatched successfully! 📋 Details:
🔗 Track Progress: |
|
🚀 Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |
|
🚀 Patch Release Started! 📋 Release Details:
⏳ Status: The patch release is now running. You'll receive another update when it completes. 🔗 Track Progress: |
|
✅ Patch Release Complete! 📦 Release Details:
🎉 Status: Your patch has been successfully released and published to npm! 📝 What's Available:
🔗 Links: |
Related Issues
Fixes https://github.com/google-gemini/maintainers-gemini-cli/issues/1329