This lesson is being recorded

Every video of this course is being uploaded to my YouTube channel. Subscribe so you do not miss it.

Bruno AshfordBruno Ashford @brunoashfordSubscribe

Module 11 · Lesson 11.3 · 10 min

Passwords, Keys and Credentials

Keep passwords, API keys and tokens out of files, prompts and conversations, and give the agent access without exposing secrets.

Module 11
Security, Governance and Trust

Real power for your agents, without losing sleep

Bruno Ashford
Bruno Ashford · Module 1101 / 12
The principle
Trust is not a feeling. It is boundaries you set, checks you run and evidence you keep.
Bruno Ashford
Bruno Ashford · Module 1102 / 12
Lesson 11.1

Permission modes

ModeWhat runs without askingUse it for
Manual (default)Reads onlySensitive work
acceptEditsReads and file editsDrafting you review
planReads, no changesThinking before acting
autoMost actions, classifier reviewsLong tasks
dontAskOnly pre-approved toolsScheduled runs
bypassPermissionsEverythingIsolated containers only

Press Shift+Tab to cycle. Check the status bar.

Bruno Ashford · Module 1103 / 12
Lesson 11.1

Rules beat reminders

Deny beats ask beats allow, in every mode.

  • Allow the boring, safe work
  • Ask for anything sensitive
  • Deny secrets, deletes and publishing
  • Review them with /permissions
Bruno Ashford · Module 1104 / 12
Lesson 11.2

Customer data habits

  1. 1List itKnow what personal data you share
  2. 2Minimise itOnly the columns the task needs
  3. 3Separate itOne client, one folder
  4. 4Check termsKnow your plan's data settings
Bruno Ashford · Module 1105 / 12
Lesson 11.2

The laws in the background

Good habits, not legal advice.

  • UK GDPR and EU GDPR
  • US state privacy laws, like California's
  • Sector rules for health, legal, finance
  • Speak to a lawyer for specifics
Bruno Ashford · Module 1106 / 12
Lesson 11.3
A secret that has been in a chat or a synced file should be treated as exposed.
Bruno Ashford
Bruno Ashford · Module 1107 / 12
Lesson 11.4

Who approves what

ActionLevelApprover
Draft a replyAutomaticNone
Send to a clientApprovalAccount owner
Refund over limitApprovalOwner
Delete recordsNever delegatedOwner, by hand
Legal noticeNever delegatedOwner and lawyer

Your full matrix is in the materials.

Bruno Ashford · Module 1108 / 12
Lesson 11.5

Three layers of verification

  1. 1Self-checkAgainst a short checklist
  2. 2Separate reviewerFresh session or subagent
  3. 3Human sample100 percent first, then sample
Bruno Ashford · Module 1109 / 12
Illustrative example, not research

One law practice, one month apart

9 to 1errors found per month
100% to 25%letters reviewed by a person
0wrong letters sent to clients
Bruno Ashford · Module 1110 / 12
Lesson 11.6

A policy people actually read

One page, plain English.

  • Approved tools and accounts
  • What data can and cannot be used
  • What always needs approval
  • Who to ask, and review quarterly
Bruno Ashford · Module 1111 / 12
Recap
Governance is what lets you say yes to AI with confidence, instead of hoping nothing goes wrong.
Bruno Ashford
Bruno Ashford · Module 1112 / 12
01 / 12

Use ← → to move. The marker highlights text and the pencil draws on the slide; navigation locks while you annotate. Undo removes the last mark, Esc exits.

1Find secrets that are already exposed

Ask Claude to scan your business folder for anything that looks like a password, API key or token, without printing the values. You may be surprised.

Prompt for Claude
Scan this folder for anything that looks like a password, API key, token or private key, including in .md, .txt, .csv and .json files. Do not print any secret values. List only the file path, the line number and the type of secret, so I can move them to my password manager.
2Move them to a password manager and rotate

Move every secret you find into your password manager and delete it from the file. If a key has ever been pasted into a chat or a shared folder, rotate it: create a new one in the service's dashboard and revoke the old one. Rotation takes five minutes; a leaked key can take months to clean up.

3Block the agent from reading secret files

Add deny rules for the places secrets live. A Read deny rule also stops the file being edited or created. Combine this with your .gitignore so secret files never end up in a shared repository.

Terminal
{
  "permissions": {
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)",
      "Read(**/*credentials*)"
    ]
  }
}
4Use connectors and scoped keys instead of passwords

When the agent needs a tool, connect it through an official connector or MCP server with its own sign-in, or create an API key with read-only or limited scope. Never give an agent your main admin password or your banking login. One key per purpose means one key to revoke if something goes wrong.

Terminal
claude mcp list
5Handle the special case of scheduled runs

Routines that run unattended still need to log in. Use the method from Module 10: a long-lived token created with claude setup-token, stored in a private file only your user can read, never inside the script or a shared folder. Write down where each token lives and when to renew it.

The most common security failure in small businesses using AI is not a clever attack. It is an API key pasted into a chat, a password saved in a notes file the agent reads every day, or a token committed to a shared folder. Once a secret has been in a conversation or a synced file, you should assume it is exposed.

The rule is short: secrets never go in prompts, CLAUDE.md, skills or shared files. They live in a password manager or in environment variables, the agent is blocked from reading secret files, and every key has the smallest permissions and a way to be revoked.

Key points

  • A secret that has been in a chat or synced file should be treated as exposed.
  • Secrets live in a password manager or environment variables, never in files the agent reads.
  • Deny rules stop the agent reading secret files.
  • Scoped, revocable keys beat admin passwords every time.

Avoid

  • Pasting an API key into the conversation to get something working quickly.
  • Saving passwords in CLAUDE.md so the agent remembers them.
  • Using one all-powerful key for every tool.
  • Not rotating a key after it was exposed because nothing bad happened yet.
Real-world example: a marketing agency

An agency in Bristol ran the scan and found 11 secrets across its folders: ad platform tokens in a notes file, an email password in an old onboarding document, and a payment provider key in a CSV. None had been misused, but the payment key had full access. They moved everything to their password manager, rotated all 11, replaced the payment key with a restricted read-only one, and added deny rules. The whole exercise took an afternoon.

Bruno Ashford Subscribe