roowBlogSign in

Arvind Ram Anantharam

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:

What the model should not see
idemailfull_namephoneplancountry
1042dana.ruiz@example.comDana Ruiz+1 415 555 0142proUS
1043li.wei@example.comLi Wei+44 20 7946 0958starterGB
1044sam.okafor@example.comSam Okafor+234 1 555 0199proNG
What the model should see
idemailfull_namephoneplancountry
1042h_3f9a21c07be4d518[redacted][redacted]proUS
1043h_a07c5e9d21f3b6e2[redacted][redacted]starterGB
1044h_5c18e0b7a9d2f364[redacted][redacted]proNG

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 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:

AccessWhat Claude seesIn this example
VisibleThe real valueplan, country, status, amounts, dates
MaskedA stable token that still joins and countscustomers.email
Hidden[redacted] in place of the valuefull_name, phone, billing_address, tickets.body
InaccessibleNothing: the table is not thereapi_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.

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.