fix(core): send Gemini API key as header, not URL query param - #13061
Open
aaronlippold wants to merge 1 commit into
Open
fix(core): send Gemini API key as header, not URL query param#13061aaronlippold wants to merge 1 commit into
aaronlippold wants to merge 1 commit into
Conversation
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
requested review from
Copilot and
sestinj
and removed request for
a team and
Copilot
July 29, 2026 15:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part 2 of 4 of #13052 (tracking issue with full root-cause analysis and the PR split plan).
fetchModelslisted 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 thex-goog-api-keyheader 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
@continue-reviewChecklist
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 viax-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.