Google OAuth2 Keys

ID

google_oauth2

Severity

low

Vendor

Google

Family

API Token

Description

Google is a technology company focusing on search engine technology, online advertising, cloud computing, computer software, quantum computing, e-commerce, artificial intelligence, and consumer electronics.

Oauth2 keys allow to build applications that can access information from a user’s Google account after they authorized the application.

Security

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

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

Examples

{
  "project_info": {
    "project_number": "459849745",
    "firebase_url": "",
    "project_id": "5cac6",
    "storage_bucket": ""
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:456490462:android:053d51a077de2230ace64f",
        "android_client_info": {
          "package_name": "io.ionic.starter"
        }
      },
      "oauth_client": [
        {
          "client_id": "456490462-9as53ra6j5mv8bnm1rchq41s7md3oj1r.apps.googleusercontent.com",
          "client_type": 3
        }
      ],
    }
  ],
  "configuration_version": "1"
}

Mitigation / Fix

  1. Remove the Keys 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). Revoking the secret can be done through the Google developers 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.