Skip to content

Debug logs are sharing (at least) Gemini API keys #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
6 tasks done
Chaoscontrol opened this issue May 7, 2025 · 2 comments
Open
6 tasks done

Debug logs are sharing (at least) Gemini API keys #334

Chaoscontrol opened this issue May 7, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@Chaoscontrol
Copy link

Chaoscontrol commented May 7, 2025

Checklist

  • I'm running the newest version of LLM Vision https://github.com/valentinfrlch/ha-llmvision/releases/latest
  • I have enabled debug logging for the integration.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This is a bug and not a feature request.
  • I have searched open issues for my problem.

Describe the issue

I created this issue sharing my debug logs, and I instantly got a notification from Google about my keys being disclosed in that exact URL. Which was my own doing, inadvertently.

Image

I'm not certain the key is the one I redacted in the logs attached, but I think so.

Reproduction steps

  1. Check debug logs with Gemini as provider. It has the API key attached to some messages.

Debug logs

2025-05-07 19:30:24.549 INFO (MainThread) [custom_components.llmvision.providers] Posting to https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=redacted
2025-05-07 19:30:26.094 INFO (MainThread) [custom_components.llmvision.providers] Posting to https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=redacted
@Chaoscontrol Chaoscontrol added the bug Something isn't working label May 7, 2025
@valentinfrlch
Copy link
Owner

Yes you are right, this shouldn't happen. The keys should be censored. Unfortunately Google for some reason requires the key in the url (every other provider uses Bearer Authentication). Only Gemini is affected.

@Chaoscontrol
Copy link
Author

Yeah I can understand that. However something could be added to the log message with a regex replace, and redact the key automatically for the logs. I think that's what other services do with their logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants