How to Safely Work With Business Data in Claude
Ask Claude which customers are about to churn, and the answer arrives with every customer’s email, phone number and billing address attached. The question never needed them.
That is what happens when Claude reads a production database directly. It sees every column of every row it touches, so the useful part of the answer travels with the sensitive part, into a chat transcript you do not control.
It does not have to. Claude can work with real business data without receiving the customer details in it. The technique is masking, and this post shows what it looks like, where it has to happen, and what it does and does not promise.
Same rows, nothing personal
Here are three customers as the database holds them, and as Claude should see them:
| id | full_name | phone | plan | country | |
|---|---|---|---|---|---|
| 1042 | dana.ruiz@example.com | Dana Ruiz | +1 415 555 0142 | pro | US |
| 1043 | li.wei@example.com | Li Wei | +44 20 7946 0958 | starter | GB |
| 1044 | sam.okafor@example.com | Sam Okafor | +234 1 555 0199 | pro | NG |
| id | full_name | phone | plan | country | |
|---|---|---|---|---|---|
| 1042 | h_3f9a21c07be4d518 | [redacted] | [redacted] | pro | US |
| 1043 | h_a07c5e9d21f3b6e2 | [redacted] | [redacted] | starter | GB |
| 1044 | h_5c18e0b7a9d2f364 | [redacted] | [redacted] | pro | NG |
The email became a token: the same email always gives the same token, so Claude can still count customers and join tables on it. The name and phone are hidden. Plan and country stay as they are, because those are what the questions are about.
Claude can still answer “which plans churn most, and where?” It just cannot tell you who anyone is.
One company, four people, one database
Take a fifteen-person company selling scheduling software on monthly plans. One PostgreSQL database, and everyone uses Claude daily:
- The founder wants revenue by plan before Thursday’s board call.
- Customer success wants to know which paying accounts are stuck.
- Support needs to follow up with those customers.
- The engineer owns the database and has a sprint to finish.
The database holds customers, subscriptions, invoices, tickets and an api_keys table. Under time pressure, the engineer does the quickest thing that works: pastes the owner database URL into Claude’s database connector and tells the team it is ready.
Within the hour, customer success asks about at-risk accounts, and Claude writes:
SELECT c.*, t.body, i.amount_cents FROM customers c JOIN tickets t ON t.customer_id = c.id JOIN invoices i ON i.customer_id = c.id WHERE i.status = 'failed';
A reasonable query, and a transcript full of names, phone numbers and support conversations. The same URL can also UPDATE and DROP, and it reaches api_keys too. Nobody decided any of that. Nothing said no.
Four kinds of access
The fix is a few decisions made once, before anyone asks anything. Every column, and some whole tables, get one of four treatments:
| Access | What Claude sees | In this example |
|---|---|---|
| Visible | The real value | plan, country, status, amounts, dates |
| Masked | A stable token that still joins and counts | customers.email |
| Hidden | [redacted] in place of the value | full_name, phone, billing_address, tickets.body |
| Inaccessible | Nothing: the table is not there | api_keys |
Two rules of thumb make the sorting quick. Mask identifiers people join and count on, like email. Leave low-variety columns like plan and country visible: masking them protects nothing, since there are only a few possible values.
Masking has to happen where the SQL runs
Claude writes its own SQL, so masking the results by column name is not enough. Two examples show why.
SELECT * FROM customers;
Nobody named email here, yet it comes back. Whatever enforces masking has to know what * expands to.
SELECT count(*) FROM customers WHERE email LIKE 'dana%';
This returns only a number, yet it tells Claude whether a customer named Dana exists, and repeating it letter by letter would spell out every address. A filter on a protected column has to test the mask, not the real value.
Both point to the same rule: rewrite each query before it reaches the database, so the protected column is replaced by its mask everywhere it appears, in the output, the filters, the joins and the functions. The technical deep dive covers how, and the cases that should simply be refused.
What masking does and does not promise
Masking reduces exposure. It does not make data anonymous.
- Tokens are pseudonyms. The same email always gives the same token, which is what makes counting and joining work. It also means everything about one token can be linked together. The token is keyed with a secret Claude never sees, so a guessed email cannot be checked against it.
- Visible columns can still identify someone. The only pro customer in Iceland who signed up last Tuesday is one person, whatever their email reads as.
- Filters match the mask.
WHERE email = 'dana.ruiz@example.com'finds nothing.WHERE email = 'h_3f9a21c07be4d518'finds the row Claude was shown, so it can still act on it. - Aggregates are not anonymity either. “Numbers only” access with a minimum group size stops accidents and casual curiosity. Two large groups that differ by one person can still be subtracted, so keep a record of who asked what.
Three people, one investigation
Back to the company, now set up properly.
Customer success asks Claude which customers paid this month but cannot log in. Claude finds three accounts. It sees their account IDs, plans and email tokens, and nothing else about them. It proposes the fix:
UPDATE customers SET has_access = true
WHERE email IN ('h_3f9a21c07be4d518', 'h_a07c5e9d21f3b6e2',
'h_5c18e0b7a9d2f364');The change does not run yet. It waits for a person to approve it.
The engineer gets the request, sees the three rows it would change, still masked, and approves it. Only then does it run.
Support takes the three account IDs to the help desk, where customer contact details already live, and lets each customer know access is back.
Meanwhile the founder gets revenue by plan for the board call, as totals only, never a customer’s rows.
Four people, one database, and nobody saw more than their job needed. No customer’s email ever reached a chat.
Know a team moving fast with Claude? Send them this.