LogicTrail
  • Trails
  • Check my app
  • Pricing
  • Sign in
  1. Trails
  2. /
  3. Money and secrets
  4. · 4 minutes · Pro

The key you pasted into chat

To get working, you pasted your into your app builder's chat. The project was public. Your builder has just announced a data exposure.

This answers: Is it safe to paste API keys into an AI chat? No coding needed. 2 quick decisions.

  • Keys and secrets
  • Supervising your AI

Checking your access…

Is it safe to paste API keys into an AI chat?

No. Chats and prompts are stored, sometimes shared with the project, and can be exposed if the project or platform leaks. Put secrets only into your app's secret or environment settings. If you already pasted one, rotate it with the provider and make the project private.

Trail of the bug
  1. Your laptop
  2. AI agent
  3. Stranger

Breaks at AI agent: Secret stored in a public chat

How it works

Where your keys end upName it NEXT_PUBLIC_

Your server: private

OPENAI_KEY (secret)

Every visitor's browser: public

Publishable key (meant to be here)
The secret key stays on your server, where visitors can't see it. Only the publishable key, made for browsers, goes out.

Why AI tools write this bug

When setup gets stuck, pasting a key into the chat is the fastest way to get an AI builder to 'just make it work'.

How to fix it

  1. Rotate any key you pasted into a chat.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock

Common questions

Does deleting the chat message remove the key?
Not necessarily. Copies may already exist. Rotating the key is the only reliable fix.

Related scenarios

  • The agent that reset productionFree · 5 min
  • The key you deletedPro · 4 min
  • The ticket that gave ordersPro · 5 min

More on this trail

Money and secrets: Keys, payments, webhooks, and reading what your AI changed.

Want someone to look?

We check AI-built apps for this and three other common leaks, in plain English.

Check my app
Sign in

Sign in to walk this one

2 decisions, about 4 minutes, and a prompt to check your own app for the same problem.

Sign in No password. We email you a link.

How to fix it

  1. Rotate any key you pasted into a chat.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock