Skip to content
Leaked secrets Write-up Beginner

The Day I Found a Google Sheets API Key Hidden in Plain Sight — Inside a Public JavaScript File

A Google API key was hardcoded in a public JavaScript file, allowing anyone to access a Google Sheets spreadsheet containing store location data without authentication. An attacker could read or potentially modify the data and cause billing spikes.

anshubind89 Follow

Published on medium.com

Some vulnerabilities scream for attention. Others sit quietly, tucked inside lines of JavaScript, waiting for someone curious enough to notice them.

Anshubind, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, the API key was embedded in client-side JavaScript without restrictions, making it publicly accessible.

Impact

Anyone could access the store location data in bulk, potentially causing billing spikes or tampering if the key had write permissions.

What the attacker needed

None

The fix

The exposed key should be revoked, replaced with a restricted key, and API calls moved server-side.

How it was found

  1. Open the public JavaScript file store-locator-am.js.
  2. Find the hardcoded Google API key inside the file.
  3. Use the key to call the Google Sheets API endpoint for the spreadsheet.
  4. Observe that the spreadsheet data is returned without authentication.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A Google API key is like a password that lets programs use Google services. Here, the key was left in a file that anyone's browser downloads, so anyone could use it to read a spreadsheet of store locations. The fix is to keep such keys on the server, not in public code.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

More by anshubind89

View all

11 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.