Skip to content

fix(core): send Gemini API key as header, not URL query param - #13061

Open
aaronlippold wants to merge 1 commit into
continuedev:mainfrom
aaronlippold:fix/gemini-fetchmodels-key-header
Open

fix(core): send Gemini API key as header, not URL query param#13061
aaronlippold wants to merge 1 commit into
continuedev:mainfrom
aaronlippold:fix/gemini-fetchmodels-key-header

Conversation

@aaronlippold

Copy link
Copy Markdown
Contributor

Description

Part 2 of 4 of #13052 (tracking issue with full root-cause analysis and the PR split plan).

fetchModels listed Gemini models by putting the API key in a ?key= query parameter. Keys in URLs leak through server logs, proxies, and referer headers. This sends the key as the x-goog-api-key header instead, matching how the rest of the Gemini integration authenticates.

Same fix as #12190 (credit to its author) — glad to coordinate; this version adds tests.

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

Screen recording or screenshot

N/A — internal HTTP call change in core/llm/fetchModels.ts (no UI).

Tests

New core/llm/fetchModels.vitest.ts (3 tests): asserts the key is sent via x-goog-api-key, asserts the key never appears in the request URL, and covers the undefined-key case. Verified manually against the live Google API (real key, outside CI): model listing returns real models with the key absent from the URL.

fetchModels listed Gemini models by putting the API key in a ?key=
query parameter. Keys in URLs leak through server logs, proxies, and
referer headers. Send it as the x-goog-api-key header instead, matching
how the rest of the Gemini integration authenticates.

Refs continuedev#13052

Authored by: Aaron Lippold<lippold@gmail.com>
@aaronlippold
aaronlippold requested a review from a team as a code owner July 29, 2026 15:55
@aaronlippold
aaronlippold requested review from Copilot and sestinj and removed request for a team and Copilot July 29, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant