{"slug": "how-to-safely-work-with-business-data-in-claude", "title": "How to safely work with business data in Claude", "summary": "A guide published on Claude's developer blog recommends masking sensitive database columns before Claude reads production data, because connecting Claude directly to a live PostgreSQL database lets it see every column of every row it touches. The post illustrates the risk with a 15-person scheduling-software company whose engineer pasted an owner database URL into Claude's database connector, after which Claude wrote a query joining customers, tickets and invoices that returned names, phone numbers and support conversations, and notes the same URL could also run UPDATE and DROP statements and reach an api_keys table. The guide assigns each column one of four treatments — visible, masked with a stable joinable token, hidden as [redacted], or inaccessible — and argues masking must be enforced where the SQL executes, since a query like SELECT * returns email even when no column is named.", "body_md": "# How to Safely Work With Business Data in Claude\n\nAsk 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.\n\nThat 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.\n\nIt 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.\n\n## [Same rows, nothing personal](#masking)\n\nHere are three customers as the database holds them, and as Claude should see them:\n\n| id |  | full_name | phone | plan | country | \n|---|---|---|---|---|---|\n| 1042 | dana.ruiz@example.com | Dana Ruiz | +1 415 555 0142 | pro | US | \n| 1043 | li.wei@example.com | Li Wei | +44 20 7946 0958 | starter | GB | \n| 1044 | sam.okafor@example.com | Sam Okafor | +234 1 555 0199 | pro | NG | \n\n| id |  | full_name | phone | plan | country | \n|---|---|---|---|---|---|\n| 1042 | h_3f9a21c07be4d518 | [redacted] | [redacted] | pro | US | \n| 1043 | h_a07c5e9d21f3b6e2 | [redacted] | [redacted] | starter | GB | \n| 1044 | h_5c18e0b7a9d2f364 | [redacted] | [redacted] | pro | NG | \n\nThe 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.\n\nClaude can still answer “which plans churn most, and where?” It just cannot tell you who anyone is.\n\n## [One company, four people, one database](#team)\n\nTake a fifteen-person company selling scheduling software on monthly plans. One PostgreSQL database, and everyone uses Claude daily:\n\n- **The founder** wants revenue by plan before Thursday’s board call.\n- **Customer success** wants to know which paying accounts are stuck.\n- **Support** needs to follow up with those customers.\n- **The engineer** owns the database and has a sprint to finish.\n\nThe 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.\n\nWithin the hour, customer success asks about at-risk accounts, and Claude writes:\n\n```\nSELECT c.*, t.body, i.amount_cents\nFROM customers c\nJOIN tickets  t ON t.customer_id = c.id\nJOIN invoices i ON i.customer_id = c.id\nWHERE i.status = 'failed';\n```\n\nA 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.\n\n## [Four kinds of access](#modes)\n\nThe fix is a few decisions made once, before anyone asks anything. Every column, and some whole tables, get one of four treatments:\n\n| Access | What Claude sees | In this example | \n|---|---|---|\n| Visible | The real value | plan, country, status, amounts, dates | \n| Masked | A stable token that still joins and counts | customers.email | \n| Hidden | [redacted] in place of the value | full_name, phone, billing_address, tickets.body | \n| Inaccessible | Nothing: the table is not there | api_keys | \n\nTwo 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.\n\n## [Masking has to happen where the SQL runs](#boundary)\n\nClaude writes its own SQL, so masking the results by column name is not enough. Two examples show why.\n\n```\nSELECT * FROM customers;\n```\n\nNobody named `email` here, yet it comes back. Whatever enforces masking has to know what `*` expands to.\n\n```\nSELECT count(*) FROM customers\nWHERE email LIKE 'dana%';\n```\n\nThis 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.\n\nBoth 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](https://roow.work/blog/masking-at-the-sql-boundary) covers how, and the cases that should simply be refused.\n\n## [What masking does and does not promise](#limits)\n\nMasking reduces exposure. It does not make data anonymous.\n\n- **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.\n- **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.\n- **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.\n- **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.\n\n## [Three people, one investigation](#together)\n\nBack to the company, now set up properly.\n\n**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:\n\n```\nUPDATE customers SET has_access = true\nWHERE email IN ('h_3f9a21c07be4d518', 'h_a07c5e9d21f3b6e2',\n                'h_5c18e0b7a9d2f364');\n```\n\nThe change does not run yet. It waits for a person to approve it.\n\n**The engineer** gets the request, sees the three rows it would change, still masked, and approves it. Only then does it run.\n\n**Support** takes the three account IDs to the help desk, where customer contact details already live, and lets each customer know access is back.\n\nMeanwhile **the founder** gets revenue by plan for the board call, as totals only, never a customer’s rows.\n\nFour people, one database, and nobody saw more than their job needed. No customer’s email ever reached a chat.\n\nKnow a team moving fast with Claude? Send them this.", "url": "https://wpnews.pro/news/how-to-safely-work-with-business-data-in-claude", "canonical_source": "https://roow.work/blog/claude-and-your-business-data", "published_at": "2026-11-22 19:20:12+00:00", "updated_at": "2026-11-22 19:42:27.056757+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "ai-safety", "ai-tools"], "entities": ["Claude", "Anthropic", "PostgreSQL"], "also_reported_by": [], "takeaway": "Enforce column masking where the SQL executes rather than on result column names, because SELECT * returns email even when no column is named; mask joinable identifiers like email with stable tokens and hide names, phone numbers and ticket bodies.", "recommendation": {"advice": "Before connecting Claude to a production database, replace joinable identifiers like email with stable tokens, redact names and phone numbers, and make sensitive tables like api_keys inaccessible, enforcing masking at the SQL layer.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/how-to-safely-work-with-business-data-in-claude", "markdown": "https://wpnews.pro/news/how-to-safely-work-with-business-data-in-claude.md", "text": "https://wpnews.pro/news/how-to-safely-work-with-business-data-in-claude.txt", "jsonld": "https://wpnews.pro/news/how-to-safely-work-with-business-data-in-claude.jsonld"}}