Skip to content
Databases & keys · Secret guide

Leaked Unsplash Access Key: what to do in the first hour

Medium severityDetected onlyLast verified · 5 min read

An Unsplash access key identifies a developer application that calls the Unsplash API to search and display photos. Each application on Unsplash has an access key and a secret key. The access key is used for ordinary read requests, and the secret key is used for the flows that act on behalf of a user. The photos Unsplash serves are public, so a leaked access key does not expose private content. The practical costs are a spent rate limit, a stopped application and, if the key is abused, a block by the provider. Regenerate the key first, then check the usage.

Check your GitHub account for leaked secrets — free

Provider
Unsplash
Severity
Medium
Impact
SaaS account access and billing
Checked live by LeakWatch
No

What an Unsplash Access Key looks like

Unsplash access keys are 43-character strings of letters, digits and underscores. They have no vendor prefix, so a match depends on the name it is stored under, such as UNSPLASH_ACCESS_KEY, or on the request that sends it:

UNSPLASH_ACCESS_KEY="…XXXX"   Unsplash access key in an environment file (masked)

The access key is sent in an Authorization header with the word Client-ID, as described in the Unsplash documentation. Because the key is meant for read requests from an application, many developers place it in front-end code, which is a common and avoidable mistake for the secret key. The secret key is a different value, and it should stay on a server.

A 43-character value next to the word Unsplash, in a file that calls the API, is a live credential. The same length next to an unrelated name is not. Check which application the key belongs to, because each application has its own pair of keys.

How Unsplash Access Keys get leaked

  • Front-end applications. A key placed in a browser script or a mobile app that loads photos directly. Anyone who loads the page can read the value.
  • Committed configuration. A .env file or a settings file with the key, pushed to a repository that was public at some point.
  • Sample projects. A demo or a starter template that ships with a real key instead of a placeholder.
  • Build logs. A deployment step that prints its environment, or an error message that shows the request headers.
  • Shared examples. A key pasted into a forum post or a support question to ask why a request fails.

What to do in the first hour

  1. Regenerate the keys. Open the applications page on your Unsplash developer account, select the application that holds the leaked key and regenerate its keys. Sources consulted for this guide describe a regenerate option that invalidates the current access key, but they used different wording, so follow what the page shows.
  2. Update your application with the new access key. If the secret key was also exposed, update it too, and store both values in a server-side environment or a secret manager.
  3. Check your usage in the developer dashboard for the period since the key may have been exposed. Look for a spike in requests or for requests from places you do not run.
  4. Move photo requests to the server if the key was used in the browser. The server can make the request and return the results, so the key never reaches the visitor.
  5. Check the other secrets that sat in the same file or the same deployment, and rotate any credential stored with them.
  6. Clean the code. Remove the value from the files and check the history for older copies. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same project? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at Unsplash

Each application on Unsplash is listed on the developer applications page, and its access and secret keys are shown on the application’s details. Open the applications page, select the application and use the option to regenerate its keys. The sources consulted for this guide were third-party and did not agree on the button label, and no official Unsplash page was found for the exact steps, so this section could not be confirmed against the live page. If you cannot find the option, create a new application with its own keys, move your project to it, and delete the old application so its key stops working.

How LeakWatch detects it

The rule is called “Unsplash Access Key”. It looks for the word unsplash followed by up to forty characters of anything, including line breaks, and then a value of exactly forty-three letters, digits or underscores with word boundaries on both sides. The name must come before the value and near it. A forty-three character string with no Unsplash name close by is not reported. The severity is medium, with the impact class for SaaS services. This type is not checked live: LeakWatch does not call Unsplash with the key it finds.

LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.

FAQ

Is an access key as sensitive as a secret key?

Less so. The access key is designed for read requests from an application, and the secret key is the one that should stay on a server. Still, a leaked access key can be used to spend your rate limit and get your application blocked, so rotate it.

Can the photos themselves be a privacy problem?

The photos are public images served by Unsplash, so the key does not unlock private content. The concern is the quota, the application and the account.

Should I keep the key in the browser code?

Avoid it. Anything in the browser is public. Make the request from your server and send the result to the browser, so the key stays private.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with Unsplash.