Check my setup

How-to5 min read

How to limit the damage if your hosting platform leaks your secrets

Two hosting platforms have reported leaked environment variables this year. These are the eight changes we would make today so the next leak is worth less to whoever gets it.

An old brass key and a new one side by side on pale linen, the new key with a small violet tag

When a hosting platform reports that customer environment variables were read, every secret you stored there becomes a problem at once. You can’t stop that from happening to your host, but you can make each secret worth much less to whoever reads it, and make replacing them a routine job instead of a lost day.

Why this is worth an afternoon now

This year two hosting platforms have reported exactly this. In April, Vercel said that environment variables not marked “sensitive” were read. On 21 October, Railway said an unauthorised party may have accessed encrypted environment variables, and for some of them obtained the decrypted contents, and asked every user to roll all of them.

In both cases the advice to customers came down to the same thing: rotate everything you stored there. How painful that is depends on choices you can make today.

Eight things you can do today

1. Keep a list of every secret

For each secret, write down its name (never the value), which services use it, who owns it, and how to rotate it at the provider. Without this list, an incident starts with an hour of searching dashboards. Stripe makes the same point about practising: periodic rotation confirms that you know where each key is used and that your team can replace a key on short notice.

2. Make secrets write-only where your host allows it

Most hosts can store a value so that nobody can read it back afterwards. On Vercel these are Secret environment variables, which are write-only after saving; on Railway they are sealed variables, which are provided to builds and deployments but can’t be seen in the dashboard or fetched through the API. After its April incident, Vercel told customers to use this feature “so that secret values are protected from being read in the future”.

Be clear about what this does: it stops values being read back through the dashboard, the API or a stolen team login. The platform still has to decrypt them to run your app, so it narrows the exposure rather than ending it.

3. Swap long-lived cloud keys for short-lived credentials

A stored cloud key works until someone revokes it. A short-lived credential expires by itself. AWS’s own guidance is to require workloads to use temporary credentials through IAM roles, and both Vercel and GitHub Actions can exchange a signed token for short-lived AWS, Google Cloud or Azure credentials, so no cloud key is stored on the platform at all.

4. Give every key the smallest job it can do

A key that can only do one thing is worth little to anyone else:

5. Lock keys to the places they are used from

Some providers will refuse a key that turns up somewhere unexpected. Stripe’s access policies can limit a key to your servers’ IP addresses, or to a cloud provider’s network and a country, and Stripe blocks the request and notifies you when someone tries to use it from elsewhere. Supabase’s network restrictions limit which IP ranges can connect to your database. Both are most useful when your host gives you fixed outbound addresses, so check that first.

6. Use different values in each environment

Preview and development deployments are often less carefully guarded than production. If they share production’s database password or payment key, a leak from any of them is a production leak. Give each environment its own values. Vercel even has a team policy that requires production secrets to differ from every other environment’s.

7. Watch for use you don’t expect

You only know a leaked key was used if you look. Know where each provider shows recent use: Stripe’s request logs for each key, AWS’s “last used” information and CloudTrail, and your AI providers’ usage pages. Check them after any incident, and now and then before one.

8. Keep a second host ready

When Railway paused all deployments during its investigation, teams could rotate keys at the provider but couldn’t redeploy their apps with the new ones. If your app builds from a Dockerfile or a standard build command, and you have deployed it once to a second host, moving is an afternoon’s work, not a project. We moved a client’s Supabase-connected worker to Render on the day Railway made its disclosure.

What we did on our own site

Our website runs on Railway, so this was not theory for us. A few choices we had made earlier limited what any one leaked value could do:

  • The email key can only send, and only from our domain. A stolen copy can’t send from any other domain or manage the account.
  • The part that scans other websites runs in its own project, holding a single variable: the key it uses to check that a request came from our site. Nothing else is stored there.
  • New keys never touch a file. We generate each one into a shell variable and set it on both services in one command, so it is never written to disk or shown on screen.

None of this meant we could skip rotating when Railway asked. It meant each value was worth less in the meantime, and we knew exactly what to replace.

Where to start this week

  1. Make the list from step 1. It is the one thing every other step needs.
  2. Mark every secret as write-only on your host, and replace your Stripe secret key with restricted keys.
  3. Split any values shared between production and other environments.
  4. Put short-lived cloud credentials and a second host on next month’s list.
  5. Rotate one key end to end, and time it, so the next incident has a known cost.

If you would like a second pair of hands with any of this, tell us about your setup or use the form below.

Sources

Checked on 23 October 2026.

  1. Railway: Security Disclosure, Wednesday October 21st (21 October 2026)
  2. Vercel: April 2026 security incident bulletin
  3. Vercel Docs: Config and Secret environment variables (write-only secrets, separate production values)
  4. Railway Docs: Variables (sealed variables)
  5. AWS: Security best practices in IAM (temporary credentials, least privilege, last used information)
  6. Vercel Docs: OpenID Connect (OIDC) Federation
  7. GitHub Docs: OpenID Connect in GitHub Actions
  8. Stripe Docs: API keys (restricted keys, access policies, request logs)
  9. Stripe Docs: Best practices for managing secret API keys
  10. Supabase Docs: Understanding API keys (a separate secret key for each backend component)
  11. Supabase Docs: Network restrictions
  12. Resend Docs: API keys (permission and domain restriction)

Need help hardening your setup?

We help teams tighten up how their apps, hosting and tools are secured: where secrets are kept and who can reach them, safe key rotation, a second host to fall back on, and logs that show misuse.

Tell us what you need

Which platforms do you use? (optional)

What you need help with, and how soon.

We use your answers only to reply to you about your request. Privacy notice.
Please don't send passwords, API keys or secret values in this form.