fix(daemon): stop leaking API keys via URL query params (H2/H3)#74
Merged
Conversation
Send Gemini keys via x-goog-api-key and accept discover-models keys only from X-Api-Key/body; reject ?apiKey= and add a CI regression check.
CI still invokes the gate; removing only the package.json entry broke lint-and-test.
Collaborator
|
Maintainer pass to bring this up to speed with current
Tip: |
cidrblock
approved these changes
Jul 17, 2026
cidrblock
left a comment
Collaborator
There was a problem hiding this comment.
Verdict: merge-ready
H2/H3 fix looks good: Gemini uses x-goog-api-key, discover-models rejects query keys, dashboard/CI gate cover the regression class, and tests pass.
Maintainer rebase onto current main is in 3e62bda (DR-035 so MCP keeps 033/034). CI green. Approving.
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.
Summary
x-goog-api-key(same as@ai-sdk/google) instead of?key=/api/discover-models/:engineIdaccepts keys only viaX-Api-Keyor JSON body (POST);?apiKey=is rejected with HTTP 400URLSearchParamsnpm run check:no-query-secretsbans?key=,query.apiKey, andparams.set('apiKey'regressions in production sourcesChanges
engines.ts/ unit test: GeminifetchModelsheader auth; assert URL does not contain the keyserver.ts: reject queryapiKey; preferX-Api-Keythen body; keep non-secretbaseUrl/providerIdindex.html: discover-models via POST +X-Api-Key/ JSON bodyscripts/check-no-query-secrets.js+package.json/ CI workflow / lean-ci skilldiscover-models-auth.test.ts(reject query, accept header/body, preference order)Test plan
npm run lintnpm testnpm run ci:build(or equivalent local gate before push)GET/POST /api/discover-models/gemini?apiKey=…→ 400X-Api-Keyor JSON{ "apiKey": "…" }→ discovery succeeds (with valid key)/v1tools passthrough from feat(openai-compat): opt-in tools passthrough for /v1 #78 still works after rebase onto mainFix: https://redhat.atlassian.net/browse/AAP-82835