Skip to content
TrustLite

Guide

Exposed API keys in apps built with AI

App builders are good at making a feature work and bad at knowing which string is a secret. If the feature worked in the browser, the key is probably in the browser.

Treat these as public the moment they are in a bundle

  • Supabase service_role JWTs. The anon key is different and is meant to be public.
  • Stripe secret keys, live or test. Publishable keys start with pk_ and are fine in the client.
  • OpenAI and Anthropic secret keys. Call the model from a server route.
  • AWS access key ids. Assume the secret key was next to it at some point.
  • Google API keys that are not restricted by referrer and API.

The first hour

Roll the key in the provider dashboard before you refactor. A deleted line in git does not un-copy a key that was already in a deployed bundle. Then move the new key to a server-only variable and ask the builder to call your route instead of the provider.

How TrustLite reports them

Findings store a short redacted prefix, the file or inline script they came from, and a prompt you can paste into Lovable, Cursor, or Bolt. The full secret is not kept. See also the Bolt checklist.