Firebase Cloud Messaging API Key

ID

firebase_cloud_messaging_key

Severity

high

Vendor

Firebase

Family

API Token

Description

Firebase is a set of hosting services for any type of application. It offers NoSQL and real-time hosting of databases, content, social authentication, and notifications, or services, such as a real-time communication server.

The Firebase Cloud Messaging (FCM) API allows to send notification messages or data messages to all users of a specific app.

Security

Any hardcoded Firebase Key is a potential secret reported by this detector.

Accidentally checking-in the key to source control repositories could compromise your Firebase account.

Examples

{
    "id": 117514,
    "device_token": "fzbgzsimhHc:APA91bFxxGOjCJ5ZXHjq6iFA9AGNwQExIych1F1OfloZMv8vZduzNuY4rJW1hn_Hrmz7i7T2ENBfH2otMeF7QtziterqPaTl19DCbSFBsRchIG8xtNQVW7Sq5q-bnvb8rL7CDod9Z6hE",
    "platform": "ANDROID"
}

Mitigation / Fix

  1. Remove the credential from the source code or committed configuration file.

  2. Follow your policy for handling leaked secrets, which typically require revoking the secret in the target system(s). API Key revocation can be handled from your Firebase project console.

  3. If under a git repository, you may remove unwanted files from the repository history using tools like git filter-repo or BFG Repo-Cleaner. You may follow the procedure listed here for GitHub.

You should consider any sensitive data in commits with secrets as compromised.

Remember that secrets may be removed from history in your projects, but not in other users' cloned or forked repositories.