# AI agents should not have hard-coded credentials in topics

AI agents should not have hard-coded credentials in topic definitions.

Source: https://maester.dev/docs/tests/MT.1119

<!-- This file is generated by website/scripts/generate-test-docs.mjs. Do not edit manually. -->

<div class="test-byline"><div class="test-byline-avatars"><a class="test-byline-avatar test-byline-avatar--author" href="/contributors/lnfernux" title="Truls Thorstad Dahlsveen · Original author"><img src="https://github.com/lnfernux.png" alt="Truls Thorstad Dahlsveen" width="28" height="28" loading="lazy" decoding="async" /></a></div><div class="test-byline-meta"><span class="test-byline-text">Contributed by <a href="/contributors/lnfernux">Truls Thorstad Dahlsveen</a></span><a class="test-byline-link" href="/contributors">All contributors →</a></div></div>

<p class="test-part">Part of <a href="/docs/tests/maester">Maester</a> · Copilot Studio · Agents · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId MT.1119
```

## Overview

AI agents should not have hard-coded credentials in topic definitions.

Hard-coded credentials such as API keys, bearer tokens, connection strings, or passwords embedded in agent topics can be extracted through prompt injection attacks. These credentials often persist in agent definitions long after they have been rotated elsewhere, creating a window of exposure.

### How to fix

Replace all hard-coded credentials with secure alternatives. Use Power Platform environment variables for configuration values and Azure Key Vault for secrets. Configure custom connectors with proper OAuth or API key authentication that stores credentials outside the agent topic definition.

Learn more: [Use environment variables in Power Platform](https://learn.microsoft.com/power-apps/maker/data-platform/environmentvariables)

## Details

<details>
<summary>Every attribute of this check</summary>

| Field | Value |
| --- | --- |
| Test ID | MT.1119 |
| Severity | High |
| Suite | Maester |
| Product | Copilot Studio |
| Feature | Agents |
| Area | AI and agents |
| Resource type | Agent |
| User impact | Low |
| Implementation cost | Medium |
| MITRE ATT&CK | T1552 Unsecured Credentials |
| Supports controls | nist-800-53-r5:IA-5(7) |
| PowerShell test | [Test-MtAIAgentHardCodedCredentials](https://github.com/maester365/maester/blob/main/tests/maester/copilot-studio/Test.MT.1119.ps1) |
| Services | Graph |

</details>

## Source

- Test: [`tests/maester/copilot-studio/Test.MT.1119.ps1`](https://github.com/maester365/maester/blob/main/tests/maester/copilot-studio/Test.MT.1119.ps1)
- Documentation: [`tests/maester/copilot-studio/Test.MT.1119.md`](https://github.com/maester365/maester/blob/main/tests/maester/copilot-studio/Test.MT.1119.md)
