Skip to content
Databases & keys · Secret guide

Leaked NYTimes Access Token: what to do in the first hour

High severityDetected onlyLast verified · 5 min read

An NYTimes access token is the key that a developer registers for the New York Times developer APIs, such as the article search, book and archive services. It identifies your application, so whoever holds it can make requests against your daily quota and, where the service is metered, against your account. The content returned by these APIs is largely public, so the direct harm of a leak is limited. The practical costs are a spent quota that breaks your application, a block from the provider if the key is flagged for abuse, and a key that can be linked to activity you did not start. Replace the key first, then check the usage.

Check your GitHub account for leaked secrets — free

Provider
NYTimes
Severity
High
Impact
SaaS account access and billing
Checked live by LeakWatch
No

What an NYTimes Access Token looks like

NYTimes developer keys are about thirty-two characters long, made of letters, digits and a few punctuation marks. They have no distinctive prefix, so the way to find one is by the name it is stored under, such as nytimes_api_key or new-york-times in a configuration file:

nytimes_api_key = "…XXXX"   NYTimes key in a script (masked)

Because there is no prefix, a match depends on context. A value of the right shape next to the word NYTimes, in a file that calls one of the New York Times APIs, should be treated as a live key. The same shape next to an unrelated name is not a leak. Keys are issued per registered application, so one account can hold several keys, and the key shown in one application is not the key of another.

A common mistake is to put the key in the URL of a request. Many NYTimes examples pass it as a query parameter, and a URL with a key in it is written to browser histories, server logs and error reports. Where your client allows it, keep the key in a server-side variable and build the request there, instead of pasting it into a link.

How NYTimes Access Tokens get leaked

  • Client-side code. A key placed in a web page or mobile app so that the page can fetch articles directly. Anyone can read it from the page source or the network traffic.
  • Committed configuration. A .env file or settings file with the key, pushed to a repository that was public at some point.
  • Notebooks and data projects. A key typed into a notebook that pulls archive data, then saved and shared with the results.
  • Shared links. A request URL containing the key, pasted into a bug report, a forum post or a chat message.
  • Logs. A server or proxy that logs full request URLs, which then hold the key for everyone who can read the logs.

What to do in the first hour

  1. Replace the key. Sign in to the New York Times developer account, open the page that lists your applications, and generate a new key for the affected application or create a new application to replace it. Then disable or remove the old key so that the leaked value stops working. This guide could not confirm the exact controls for regenerating a key, so follow what the page shows.
  2. Update your application with the new key, and store it in a server-side environment variable or a secret manager. Test a request before you consider the rotation finished.
  3. Check your request usage in the developer account for the period since the key may have been exposed. Look for a sudden spike in requests, calls at unusual hours or queries you do not recognize.
  4. Look for blocks or notices. If the provider has flagged or limited the key, read the notice, because it may describe what it saw.
  5. Check the other secrets that were in the same file or the same deployment, and rotate any credential that was stored next to the key.
  6. Clean the code. Remove the value from the current files, move request building to the server, 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 NYTimes

Keys are tied to the applications you register in the New York Times developer portal, and that is where you should look for them. Open the applications page, select the application that holds the leaked key, and use its key management options to regenerate or remove the key. If you cannot find a way to disable an old key, delete the application that owns it and create a new one. Public guidance for this provider was not found during the research for this guide, so the exact labels and the behaviour of the old key could not be confirmed. Check the portal itself, and contact the developer support team if you cannot complete the rotation.

How LeakWatch detects it

The rule is called “NYTimes Access Token”. It looks for one of the names nytimes, new-york-times or newyorktimes close to an assignment such as an equals sign or a colon, followed by a value of thirty-two characters made of lowercase letters, digits, equals signs, underscores and dashes. The name must appear before the value, close to it. The match is case-insensitive. A value with no New York Times name nearby is not reported. The severity is high, with the impact class for SaaS services. This type is not checked live: LeakWatch does not call the New York Times API 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 the New York Times content itself sensitive?

The articles and archive data are largely public, so the content is not the main risk. The concern is the key: the quota it consumes, the account it is linked to, and the possibility of a block if the key is flagged.

Why does a key in a URL matter?

A URL is recorded in many places, including browser histories, proxy logs and error reports. A key in a URL can therefore be read long after the request was made. Moving the key into a server-side variable keeps it out of most of those records.

Can I keep the old key for a few days while I deploy the new one?

Keep it only as long as you need to deploy, and then remove it. An old key that still works is a standing risk, so set a short window and treat it as a deadline.

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

LeakWatch is not affiliated with NYTimes.