Skip to content

[awf] api-proxy: Gemini engine bypasses proxy — GEMINI_API_KEY not injected, requests reach Google directly #2343

Closed

Description

@lpcox

Problem

When using the Gemini engine (AIza... key), all requests fail with 400 API_KEY_INVALID from generativelanguage.googleapis.com. The gemini CLI ignores GEMINI_API_BASE_URL=(172.30.0.30/redacted) and connects directly to Google from the agent container (172.30.0.20`), bypassing the api-proxy sidecar entirely. No key is injected, so the request reaches Google unauthenticated or with an empty key.

Context

Reported in github/gh-aw#29417. Affects gh-aw v0.71.3 with AWF firewall image 0.25.29. Squid access.log confirms source IP 172.30.0.20 (agent) instead of 172.30.0.30 (api-proxy). awf-config.json correctly shows "apiProxy": {"enabled": true, "targets": {"gemini": {"host": "generativelanguage.googleapis.com"}}}, indicating the config is generated but not honoured at runtime.

Root Cause

The gemini CLI does not respect the GEMINI_API_BASE_URL environment variable for all request paths (or the variable name/format differs from what the CLI expects). The api-proxy intercept on port 10003 is therefore never reached.

Proposed Solution

  1. In containers/api-proxy/, audit the Gemini proxy handler — verify port 10003 is listening and forwarding correctly.
  2. Determine the exact env var name(s) the installed gemini CLI version uses for base URL override; update src/docker-manager.ts to set the correct variable(s).
  3. Add an integration test that asserts Gemini traffic originates from 172.30.0.30, not 172.30.0.20.

Generated by Firewall Issue Dispatcher · ● 1M · ◷

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions