feat(core): implement HTTP authentication support for A2A remote agents#20510
feat(core): implement HTTP authentication support for A2A remote agents#20510SandyTao520 merged 7 commits intomainfrom
Conversation
|
Hi @SandyTao520, 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 significantly enhances the authentication capabilities for A2A remote agents by introducing robust support for various HTTP authentication schemes. This change provides greater flexibility in how remote agents can secure their interactions, moving beyond previous limitations and allowing for dynamic credential management and automatic retry mechanisms. The integration of a dedicated authentication provider factory streamlines the authentication process across the system, making it more extensible and maintainable. Highlights
Changelog
Activity
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
|
There was a problem hiding this comment.
Code Review
This pull request introduces robust support for HTTP authentication in A2A remote agents, including Bearer, Basic, and custom schemes. The implementation correctly uses a factory for creating auth providers, handles dynamic credential resolution from shell commands and environment variables, and adds automatic retry logic on authentication failures. The agent loader and registry are updated accordingly, and new tests provide good coverage. I've identified one high-severity issue related to case-sensitive handling of authentication schemes, which could impact usability. My feedback includes a specific suggestion to make the new HttpAuthProvider more robust by handling schemes in a case-insensitive manner.
|
Size Change: +14.7 kB (+0.06%) Total Size: 25.8 MB
ℹ️ View Unchanged
|
6cae89c to
9c780ae
Compare
99f9288 to
cfb1a49
Compare
cfb1a49 to
20e3baf
Compare
20e3baf to
e15511f
Compare
adamfweidman
left a comment
There was a problem hiding this comment.
Looks good to me, just left a few comments
- Mask Authorization header value in server log to avoid leaking secrets - Remove silent ADC fallback when auth is explicitly configured - Guard retry re-initialization behind max-retries check - Fix TypeScript narrowing by using 'in' operator for union discrimination - Add tests for auth provider factory failure paths
…-gemini/gemini-cli into st/feat/remote-agent-auth # Conflicts: # packages/a2a-server/src/http/app.ts # packages/core/src/agents/auth-provider/http-provider.ts # packages/core/src/agents/registry.test.ts # packages/core/src/agents/registry.ts # packages/core/src/agents/remote-invocation.test.ts # packages/core/src/agents/remote-invocation.ts
Default to no-auth when auth is not configured instead of silently falling back to ADCHandler. ADC support can be re-added later as an explicit auth type.
…ts (google-gemini#20510) Co-authored-by: Adam Weidman <adamfweidman@google.com>
…ts (google-gemini#20510) Co-authored-by: Adam Weidman <adamfweidman@google.com>
…ts (google-gemini#20510) Co-authored-by: Adam Weidman <adamfweidman@google.com>
Summary
This PR implements comprehensive HTTP authentication support for A2A remote agents. It enables agents to use Bearer, Basic, and custom IANA schemes (via a Generic Raw mode) as defined in their Markdown frontmatter, transitioning the previous TODO state into a fully functional system.
Details
Authorization: <scheme> <value>).AgentRegistryandRemoteAgentInvocationto useA2AAuthProviderFactory, allowing agents to resolve secrets via environment variables ($ENV) or shell commands (!command) for all HTTP fields.valuefield in agent Markdown frontmatter and ensured proper validation of HTTP schemes.a2a-serverAgent Card and added acustomUserBuilderto validate credentials during testing.Related Issues
Related to #17599
How to Validate
npm test -w @google/gemini-cli-core -- src/agents/auth-provider/http-provider.test.tsnpm test -w @google/gemini-cli-core -- src/agents/agentLoader.test.tsnpm test -w @google/gemini-cli-core -- src/agents/remote-invocation.test.tsnpm test -w @google/gemini-cli-core -- src/agents/registry.test.ts.mdfile.Pre-Merge Checklist