---
title: "Secrets and credentials"
section: "Data Source"
description: "Handle secrets in SmartestQA: encrypted Data Source keys, connection passwords, who can show a value, masking in run logs and reports, and the rules for AI assistants."
url: https://docs.smartestqa.ai/en/data-source-secrets.html
audience: [customer, admin]
updated: 2026-11-08
keywords: "secret password token api key encrypt encrypted key credential mask show reveal creator connection password aes log masking mcp security"
---
# Data Source: Secrets and credentials

A password typed into a test step is visible to everyone who opens the test. Keep every secret in an encrypted key or in a connection, and let steps reference it.

## In short

**On this page you can**

- Store a password, token or API key as an encrypted key.
- Keep database and Kafka passwords in their connection, never in a step.
- Replace a secret without seeing the old one.
- Show an encrypted value again if you created it.
- Rely on runs to mask encrypted values in logs and reports.

**How to use it**

1. Create a key and leave Value comes from on Typed value .
2. Switch on Encrypt , type the secret and click Save .
3. In the step, use {{ds:yourKey}} instead of the secret.
4. To change it later, type the new value and save; leave the field empty to keep it.
5. Check the run log: the value shows as •••••• .

## Where secrets belong

| Secret | Put it in | The step uses |
| --- | --- | --- |
| Test user password typed into a login form | An [encrypted key](https://docs.smartestqa.ai/en/data-source-secrets.html#encrypt), for example `adminPassword` | `{{ds:adminPassword}}` as the Type value |
| API token or API key | An encrypted key, for example `apiToken` | `{{ds:apiToken}}` in the Bearer token or a header |
| Database password | The [DB connection](https://docs.smartestqa.ai/en/data-source-connections.html#add-db) | The connection, picked by name |
| Kafka SASL password | The [Kafka connection](https://docs.smartestqa.ai/en/data-source-connections.html#add-kafka) | The connection, picked by name |
| [Test mailbox](https://docs.smartestqa.ai/en/integrations-email.html) password | The email integration under **Integrations** | The [Mail step](https://docs.smartestqa.ai/en/automate-steps-mail.html)’s mailbox |

> **Important: Never type a secret into a step**
>
> Step values are stored with the test case and shown to every project member who opens it. A reference such as `{{ds:adminPassword}}` carries none of that risk. The same goes for a token typed into a saved request on the [API Requests](https://docs.smartestqa.ai/en/api-requests.html) page: anyone who opens the request can read it.

## Encrypt a value

1. **Open or create the key**

   In **Variables**, click [**New key**](https://docs.smartestqa.ai/en/data-source-variables.html#create-key) or open an existing key. [**Value comes from**](https://docs.smartestqa.ai/en/data-source-variables.html#value-source) must be [**Typed value**](https://docs.smartestqa.ai/en/data-source-variables.html#value-source): a dataset or database value cannot be encrypted.
2. **Switch on Encrypt**

   Click **Encrypt** next to the value. The hint says “Store the value encrypted: it is never shown again and only the test run reads it.”
3. **Type the secret**

   The field hides what you type. If the key already had a plain value, you can leave it: on save, that value is encrypted.
4. **Save**

   The field now shows “•••••• (set, encrypted)” and “Encrypted. Leave it empty to keep the current value; type a new one to replace it.” In the list the key’s kind is **Encrypted** and its value “•••••••• set”.

### Replace or remove a secret

- **Replace:** type the new value and save. Anyone who can edit keys can replace a secret without seeing the old one.
- **Keep:** leave the field empty and save; the stored secret stays.
- **Switch Encrypt off:** the old secret is never shown, so the field is empty. Type the new plain value before you save; saving an empty field leaves the key without a value and the secret is gone.
- **Copy:** copying an encrypted key gives a plain key without a value. Type the secret again and switch on **Encrypt**.

## Who can see an encrypted value

| Where | What appears |
| --- | --- |
| The key list | “•••••••• set”, or “no value”. Also for its creator. |
| The key panel, for the creator | An eye icon: “Show the value (only you, its creator, can)”. Click again to hide it. |
| The key panel, for anyone else, [Admins](https://docs.smartestqa.ai/en/company-settings-roles.html) included | Only “•••••• (set, encrypted)”. No eye icon. They can replace the value. |
| Test runs | The runner receives the real value and uses it in the step. |
| [Live log](https://docs.smartestqa.ai/en/automate-dry-run.html#live-log), [run report](https://docs.smartestqa.ai/en/report.html), API request log | `••••••` |
| **Send** previews on the screen | `••••••` is sent in place of the value. Check secured calls with a Dry Run. |
| The AI ([App Map](https://docs.smartestqa.ai/en/discover-app-map.html), generation) | Key names and “encrypted”, never the value. |
| AI assistants through [MCP](https://docs.smartestqa.ai/en/mcp.html) | Never the value. They cannot write one either; see [AI assistants](https://docs.smartestqa.ai/en/data-source-secrets.html#mcp). |

On the server, encrypted keys and connection passwords are stored with AES-256-GCM.

## Secrets in runs

Before a run writes a log line, a report entry or a live message, it replaces every known secret with `••••••`:

- the value of every encrypted key read during the run;
- the Authorization, token and API key headers of [API steps](https://docs.smartestqa.ai/en/automate-steps-api.html);
- text typed into a password field.

In the report’s list of variables, values whose name looks like a password or token (password, token, secret, api key, bearer, cookie and similar), Authorization values and copies of encrypted values are shown as `••••••`. Values shorter than 3 characters are not masked, so do not use very short test passwords.

> **Warning: Masking hides values, not screenshots**
>
> A [screenshot](https://docs.smartestqa.ai/en/report-steps.html#screenshots) of a page that displays a secret still shows it. Do not make tests open pages that print passwords or tokens in clear text.

## Connection passwords

- DB and Kafka passwords are required when you create a connection and stored encrypted.
- They are never sent back to the screen. The field stays empty when you open the connection; leave it empty to keep the password.
- **Test Connection** on a database reads the stored password on the server. A failure message masks it (`password=***`).
- The runner receives the password with the run that needs it, and masks it like any other secret.

## AI assistants (MCP)

An assistant connected through the SmartestQA [MCP server](https://docs.smartestqa.ai/en/mcp.html) follows fixed rules:

- It never asks you for a password and never writes one. When a test needs a credential, it creates the key empty (encrypted for secrets) and asks you to fill it in SmartestQA.
- Requests it adds to the [API library](https://docs.smartestqa.ai/en/api-requests-library.html) carry tokens and passwords only as `{{ds:key}}` references.
- It reads connections with their credentials masked, and can test them.

More in [FAQ › MCP](https://docs.smartestqa.ai/en/data-source-faq.html#mcp).

## Checklist

#### Do

- One encrypted key per secret, with a **Description**.
- Dedicated test users and a dedicated [test mailbox](https://docs.smartestqa.ai/en/integrations-email.html).
- Least-privilege database users.
- Rotate a secret by typing the new value and saving.

#### Don’t

- Passwords in step values, datasets, descriptions or URLs.
- Literal tokens in saved API requests.
- Real people’s logins or inboxes.
- Switching **Encrypt** off without a new value.
