> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudthinker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Protection

> Handle a secret caught in chat, read the placeholders agents show in place of secrets, and know what the model sees.

CloudThinker catches secrets on the way in, when you paste them into chat, and on the way out, when an agent's tools return them. This page shows what you'll see in each case and what to do about it.

## Prerequisites

* The paste scan and exact-match masking of secrets CloudThinker holds are always on, for everyone who can chat. There's nothing to turn on.
* Masking of secret formats you never saved follows the **API keys** and **Cloud credentials** rows in [Guardrails](https://docs.cloudthinker.io/guide/security/custom-guardrails.md#what-agents-see). Both are on by default, but a workspace Admin can turn them **Off** unless an organization Admin locks them.
* To save a caught secret as a [credential](https://docs.cloudthinker.io/guide/credentials.md): the **Admin** workspace role. Developers can still redact or keep the text.

## What's protected, and where

![Your message passes the paste scan and agent tool output passes placeholder replacement before the model, chat, or stored output gets it](https://mintcdn.com/cloudthinker/Oe5_AUbJ0QRKLeSx/images/security/diagram-whats-protected-light.svg?fit=max\&auto=format\&n=Oe5_AUbJ0QRKLeSx\&q=85\&s=2785142fed9e5962e4f4143d0a2a3625)

The model, chat, and stored output get placeholders, never the real value.

| Moment | What CloudThinker does | What you see |
| - | - | - |
| You send a message, or paste long text | Scans it for credential-shaped values such as API keys, tokens, passwords, and connection strings | The **Review detected secrets** dialog, before anything sends |
| An agent's tool returns a secret | Replaces the value before the model, the chat, or stored output gets it. It checks two ways: an exact match against secrets CloudThinker holds for the run (connection secrets, and workspace credentials saved under a secret-sounding name such as `API_KEY`, `TOKEN` or `PASSWORD`), and the **API keys** and **Cloud credentials** pattern rules in [Guardrails](https://docs.cloudthinker.io/guide/security/custom-guardrails.md#what-agents-see). Those two rows are on by default but not locked, so a workspace Admin can turn them off. While they're on, an AWS secret key in a config file an agent prints is hidden even if you never saved it. | A placeholder such as `ct:secret:v3:openai-api-key:2d9c4e7a0b16` |
| An agent's tool returns a protected identifier, such as an email address | Replaces it the same way, using your [Guardrails](https://docs.cloudthinker.io/guide/security/custom-guardrails.md) settings | A placeholder such as `ct:pii:v3:email:4c1f0a9e27b3 [op***@ma***.com]` |

## What the model sees

The model gets your message after the paste scan, and agent tool output after placeholders replace secrets and protected identifiers. It never gets the real value behind a placeholder.

## Handle a secret you pasted

Say you paste a message that includes a live key:

```text theme={null}
Check why this key gets 401s from the billing API: sk-live-...
```

**1. Send the message**

Press Enter as usual. The message doesn't send. The **Review detected secrets** dialog opens and lists each value it found.

**2. Check each item**

For a false positive, such as an example string, click **Mark as not a secret** on its row. That text stays as you wrote it, and it sends as typed, so only mark text you're sure isn't a real secret. If you're an Admin, each row also shows the credential key name it will be saved under. Edit it if needed.

**3. Choose what happens to the rest**

| Button | Result |
| - | - |
| **Save secrets** (Admin only) | Stores each value as a workspace credential under its key name, and puts the key name in your message where the value was |
| **Redact from message** | Replaces each value with `[sensitive data removed]` |
| **Keep in message** | Shows instead of **Save secrets** when you've marked every item as not a secret. Sends the text unchanged, real secret or not. |
| Close the dialog (Esc) | Nothing sends. A typed message stays in the box with the value still flagged, so you can edit it. A long paste is discarded. |

With **Save secrets**, the example message sends as:

```text theme={null}
Check why this key gets 401s from the billing API: $BILLING_API_KEY
```

A command that uses `$BILLING_API_KEY` gets the real value when it runs. The model and the chat only see the name.

**Success state:** the message sends with a `$KEY` name or `[sensitive data removed]` where each flagged value was. An item you leave flagged can only be saved or redacted. An item you mark as not a secret sends as typed, so marking a real secret that way puts it in the conversation.

The scan covers the text you type and the text you paste, including a long paste that becomes an attachment. Next time, skip the dialog by referencing a saved key. Workspace Admins can type `$` in the chat box and pick it from the list. Other members type the name in full, such as `$BILLING_API_KEY`. See [Use a credential in chat](https://docs.cloudthinker.io/guide/credentials.md#use-a-credential-in-chat).

## Read a placeholder in agent output

When an agent's work would show a secret (one CloudThinker holds, or one that matches a Guardrails credential rule) or a protected identifier, you see a placeholder instead.

* **The same value gets the same placeholder** within a conversation, so you and the agent can still tell that two references point to one secret. In another conversation, the same value gets a different placeholder.
* **A placeholder can't be turned back into the value**, by you or by an agent. There's no reveal button.
* **The parts of a placeholder:** `ct`, then `secret` or `pii`, the format version (`v3`), the category (such as `openai-api-key`), and an ID. The ID is a keyed HMAC-SHA256 value that mixes in the conversation, so it can't be brute-forced back to a short password without CloudThinker's key.
* **Identifier placeholders may carry a hint** in brackets, such as `[***-***-**89]` for a phone number, so the output stays readable.

To change the secret itself, update it in [Connections](https://docs.cloudthinker.io/guide/connections/overview.md) or [Credentials](https://docs.cloudthinker.io/guide/credentials.md). To choose which identifiers are hidden, use [Custom Guardrails](https://docs.cloudthinker.io/guide/security/custom-guardrails.md).

> [!NOTE]
>
> If you open a CloudThinker demo replay, secrets and identifiers show as `***REDACTED***`. Customer workspaces can't create replay links yet. See [Sharing](https://docs.cloudthinker.io/guide/sharing.md).

## Unsent drafts

Text you've typed but not sent stays in your browser, not on CloudThinker's servers, so a reload doesn't lose it. A conversation draft is kept for up to 24 hours. Logging out clears every saved draft.

> [!NOTE]
>
> The secret scan runs when you send, not while you type. On a shared computer, log out instead of closing the tab if a draft might hold a secret.

## Troubleshooting

> [accordion] The dialog flagged something that isn't a secret
>
> **Cause:** the value looks like a key, for example a long random test string.
>
> **Fix:** click **Mark as not a secret** on that item. When every item is marked, click **Keep in message** and the message sends unchanged.

> [accordion] I don't see Save secrets
>
> **Cause:** saving creates a shared workspace credential, which needs the **Admin** workspace role.
>
> **Fix:** choose **Redact from message**, then ask a workspace Admin to add the key in **More → Workspace settings → Credentials**. See [Credentials](https://docs.cloudthinker.io/guide/credentials.md).

> [accordion] An agent shows a placeholder where I need the real value
>
> **Cause:** the value matches a saved secret or a protected identifier.
>
> **Fix:** for a secret, reference it as `$KEY` so commands get the value without it showing in chat. For an identifier, a workspace Admin can turn that protection **Off** in **Admin Settings → Guardrails**, unless an organization Admin has locked it.

> [accordion] A secret got through the scan
>
> **Cause:** the scan looks for known credential formats. An unusual format can be missed.
>
> **Fix:**
>
> 1. Rotate the secret at its provider. Assume the model saw it.
> 2. Ask a workspace Admin to delete the conversation (**Delete Conversation** in the conversation's title menu), so the raw value isn't kept in its history.
> 3. Save the new value as a credential and reference it as `$KEY`.
>
> To catch that format next time, a workspace Admin can add a [custom pattern](https://docs.cloudthinker.io/guide/security/custom-guardrails.md#add-a-custom-pattern). It masks matches in tool output (as a `ct:pii` placeholder), not in the paste scan. For a secret format the scan should know, tell CloudThinker support.

## Next steps

> [card] [Custom Guardrails](https://docs.cloudthinker.io/guide/security/custom-guardrails.md)
>
> Choose which identifiers agents see as placeholders

> [card] [Credentials](https://docs.cloudthinker.io/guide/credentials.md)
>
> Save secrets once and reference them as \$KEY


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.