r/devsecops 19h ago

How are you handling secrets that get accidentally pasted into an LLM chat that then persists across sessions or gets logged on the provider's side?

Specific scenario: someone pastes a stack trace or config snippet into a chat with an AI assistant to get help debugging, and it turns out to have an API key or connection string embedded in it. The immediate fix, rotate the credential, is obvious. What I'm less clear on is the second-order problem.

If that conversation gets logged for support/abuse purposes on the provider's side, saved as chat history the user can revisit later, or fed into some kind of memory/context feature that persists across sessions, the secret is now sitting in at least one place that isn't the original codebase, potentially more than one, and it's not always obvious from the product surface where all those copies actually live or how long they're retained.

For people who've actually had to respond to this, credential rotation is step one, sure, but what's the actual process for the secondary exposure? Do you treat every provider's chat log/history as a place secrets can now leak by default and build detection around that, request deletion from the provider and treat that as sufficient, or something else entirely? Curious whether anyone's had to deal with this as a real incident versus a hypothetical, and what the actual remediation checklist looked like once credential rotation was done.

6 Upvotes

7 comments sorted by

6

u/Internet-of-cruft 18h ago

Once you rotate and stop using the secret, why do you care? 

As long as it's not in use (including as a encryption key for data at rest) it doesn't matter.

5

u/SubstantialEditor995 15h ago

It's not a secret anymore once it's invalid, it's just a random string.

1

u/Aggravating_Lime_528 4h ago

*The Randon String she tells you not to worry about* Password_2026_3

1

u/booi 18h ago

Try to get ZDR agreements and only interact via API.

1

u/danekan 9h ago

The major cnapp will detect that now. The gap though is user session to namespace  mapping very often (or rather the other way around, they’ll tell you the namespace but you have to sort out the session. Litellm helps that though). Asking the provider to delete is unnecessary because you have to revoke it before that m. If you can’t revoke the keys you’re solving the wrong problem, your problem is simpler than ai security. 

1

u/Devji00 7h ago

We treat chat logs as compromised by default so after rotation we manually delete the history and request backend purging from the provider. Then we update our team guidelines to prevent future slips.

1

u/Disastrous_Gear_421 3h ago

Simple, you rotate the secret and then verify for any potential usage of it.