谷歌API密钥并非秘密,但Gemini改变了规则。
Google API Keys Weren't Secrets. But Then Gemini Changed the Rules

原始链接: https://simonwillison.net/2026/Feb/26/google-api-keys/

A significant security flaw was discovered in Google’s Gemini API stemming from shared API keys with Google Maps. Maps API keys are intentionally public as they’re embedded in websites, but Gemini keys grant access to sensitive data and billable services and *should* be kept secret. The issue arose because enabling the Gemini API on a project automatically granted those same privileges to existing, public Maps API keys – without any notification to developers. This “privilege escalation” allowed anyone finding these keys (like the 2,863 discovered by Truffle Security in web crawls) to access Gemini functionalities, including potentially private files and incurring charges. Even Google internal keys were affected, some existing for years before Gemini’s launch. Google is currently revoking compromised keys, but developers are advised to proactively check for exposure. The incident highlights a dangerous lack of clear separation and communication regarding API key permissions.

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 [重复]speckx 1小时前 | 隐藏 | 过去 | 收藏 Daviey 14分钟前 [–] 重复,这是权威文章 - https://news.ycombinator.com/item?id=47156925 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请YC | 联系 搜索:
相关文章

原文

26th February 2026 - Link Blog

Google API Keys Weren't Secrets. But then Gemini Changed the Rules. (via) Yikes! It turns out Gemini and Google Maps (and other services) share the same API keys... but Google Maps API keys are designed to be public, since they are embedded directly in web pages. Gemini API keys can be used to access private files and make billable API requests, so they absolutely should not be shared.

If you don't understand this it's very easy to accidentally enable Gemini billing on a previously public API key that exists in the wild already.

What makes this a privilege escalation rather than a misconfiguration is the sequence of events. 

  1. A developer creates an API key and embeds it in a website for Maps. (At that point, the key is harmless.) 
  2. The Gemini API gets enabled on the same project. (Now that same key can access sensitive Gemini endpoints.) 
  3. The developer is never warned that the keys' privileges changed underneath it. (The key went from public identifier to secret credential).

Truffle Security found 2,863 API keys in the November 2025 Common Crawl that could access Gemini, verified by hitting the /models listing endpoint. This included several keys belonging to Google themselves, one of which had been deployed since February 2023 (according to the Internet Archive) hence predating the Gemini API that it could now access.

Google are working to revoke affected keys but it's still a good idea to check that none of yours are affected by this.

联系我们 contact @ memedata.com