The leak check found a Google API key in my frontend. Is that a problem?
Usually not. A Google key (it starts AIza) is often meant to be in the browser for Maps or Firebase. It's still worth five minutes: an unrestricted key works for every API in its Google Cloud project that accepts keys, and someone can copy it and spend on your account. Check it in this order.
How to check it
- Sign in to the Google Cloud console, open APIs & Services → Credentials, and find the key that matches the one the scan found. Firebase keys show up here too, named something like "Browser key (auto created by Firebase)".
- Open the key. Under API restrictions, choose Restrict key and tick only the APIs this page uses (for example Maps JavaScript API, or the Firebase APIs your app calls). Save.
- Under Application restrictions, choose Websites and add your domains (for example
example.com/*andwww.example.com/*). Save. - Check the key's API list for the Generative Language API (Gemini). If it's there, take it off. Create a separate Gemini key, store it only as a server-side environment variable, and call Gemini from a server route. If Gemini was on it, also rotate the public key: create a new one with the same restrictions, put it in your app, redeploy, and delete the old one.
- If you use Firebase, open Firestore, Realtime Database and Storage in the Firebase console and check that Security Rules protect your data. The key doesn't, so rules that allow anyone to read or write leave the data open.
- Scan again. The warning stays while the key is in the page, which is fine once it's restricted.
Common questions
Is a Firebase API key a secret?
No. Google's Firebase docs call these keys public by design: they name your project, and Security Rules, IAM and App Check decide what anyone can do. That only holds while the key is restricted to Firebase APIs, so check its API restrictions anyway.
Why is this a warning and not an F?
Because a Google key in a web page is often there on purpose. The scan can't see the key's restrictions from outside, so it flags the key for you to check and leaves your grade alone.
What can someone do with an unrestricted key?
Google's docs say a key with no API restrictions works with every API in the project that accepts keys. Someone who copies it can call those APIs, such as Maps or Places, from their own site, and the bill comes to you. A website restriction blocks casual reuse, and API restrictions limit what a copied key can reach.
Why does Gemini matter here?
Every Gemini call is billed to your account, so a Gemini key belongs on a server. Google's Firebase docs say never to add the Gemini API to a key that is public or shared with other services. If your public key lists it, take it off and give Gemini a key of its own.
Restricted it? Scan again to check nothing else turned up.
Scan your app for leaks