On this pageSix mistakes that leak data
A sales lead builds a deal dashboard in an afternoon with an AI app builder. Finance builds an invoice matcher, HR a leave tracker. The apps work, and that is the trap: "it works" and "it is safe" are different tests, and AI tools optimize for the first one. The leaks they produce are predictable, look the same in every department, and mostly take minutes to fix before launch. Below are the shared mistakes, then what changes for customer, financial and employee data.
Six mistakes that leak data
1. Secrets shipped to the browser
Anything in front-end code is public. Build tools put some environment variables into the JavaScript bundle by design: Vite exposes variables prefixed with VITE_, and Next.js inlines those prefixed with NEXT_PUBLIC_. An AI assistant asked to "connect the CRM" will often put the key there, where anyone who opens the page can read it in the browser's developer tools.
The fix is structural: calls to the CRM, ledger or HR system go through a small server-side endpoint that holds the key, and the browser only receives results. Then check the build output, and run a secret scanner such as gitleaks or TruffleHog over the repository history, since a key committed once stays in Git after you delete it:
# Look for anything credential-shaped in the production build
grep -rEn "(api[_-]?key|secret|token|Bearer )" dist/ build/ .next/static/ 2>/dev/null | head -20
2. Tables open to anyone holding the public key
Backend-as-a-service platforms hand the browser a key on purpose and rely on database rules to limit it. In Supabase, the publishable key is meant to be public; protection comes from Row Level Security. A table in an exposed schema without RLS is readable and writable by any role with a grant on it. Once RLS is on, the publishable key sees nothing until you write policies, and the secret key bypasses RLS, so it must never reach the browser.
alter table public.deals enable row level security;
create policy "owners read their deals"
on public.deals for select to authenticated
using ((select auth.uid()) = owner_id);
Firebase follows the same pattern with Security Rules. Test every table while signed in as a second, ordinary user: if that user can read someone else's rows, the policy is wrong.
3. A public link with no sign-in
Preview deployments and share links are reachable by anyone who has the URL, and URLs travel through chat logs, browser history and screenshots. Put every page and every API route behind company sign-in (SSO with OIDC, through the platform's access controls or an authenticating reverse proxy), or keep the app on a private network reached over VPN. Then check from a logged-out terminal:
curl -s -o /dev/null -w '%{http_code}\n' https://tool.example.com/api/deals
Anything other than 401, 403 or a redirect to the login page means the data is public.
4. Integration keys with admin rights
The quickest key to create is usually an administrator's. Create a dedicated integration user or app instead, with read-only scopes on the objects the tool needs, one key per tool, and an expiry date. Revoking one tool's access then breaks nothing else, and the integration's activity log shows exactly what it touched.
5. Real records in prompts and logs
People paste a real export into the AI chat to "test with real data", apps log full request bodies, and features that call a language model send records to a third party. Build and test with synthetic or masked data. Log record IDs, not records. If personal data goes to a model provider, read its retention and training terms, and under the GDPR put a data processing agreement (Article 28) in place first. Send only the fields the feature needs.
6. Nobody owns it after launch
The code sits in a personal account, dependencies age, and no alert reaches anyone. Move the repository into a company organization, name an owner, schedule dependency checks (npm audit or pip-audit), and set a removal date for tools meant to be temporary.
Customer records
A leaked CRM key typically reaches contacts, email addresses, phone numbers, deal notes and often a bulk export. The GDPR requires you to notify the supervisory authority of any breach that endangers people's rights, within 72 hours of learning about it where feasible and always without undue delay; if the risk to them is high, you must tell the affected people as well. In California, the CCPA lets consumers sue over breaches of certain unencrypted personal information caused by a failure to keep reasonable security.
Checks specific to customer data:
- No "export everything" endpoint; paginate and rate-limit list routes.
- Mask email addresses and phone numbers in list views; show them in full only on the record page.
- Match the CRM's own visibility rules, such as territories or teams, instead of showing every rep every account.
Financial data
Ledgers, bank feeds, payroll and invoices carry two risks: exposure and unauthorized changes.
- Reporting tools get read-only connections.
- Any action that moves money or posts an entry needs approval from a second person, and the app records who approved what.
- If the company is publicly listed in the United States, changes that touch financial reporting fall under its internal controls (SOX), so involve whoever owns them before launch.
- Never store payment card numbers or security codes. Let the payment provider's hosted checkout handle them, which also reduces your PCI DSS scope.
- Mask bank account numbers everywhere except where a person must verify them.
Employee data
HR files often include special category data under GDPR Article 9, such as health information in sick notes or trade union membership, which needs a specific legal basis and tighter access than ordinary personal data.
The rules sharpen when the tool itself uses AI to screen, rank or evaluate people:
- The GDPR (Article 22) restricts decisions based solely on automated processing that significantly affect someone.
- The EU AI Act treats AI used for recruitment, promotion, termination, task allocation and performance monitoring as high-risk. Under the timeline amended in 2026, those obligations apply from 2 December 2027. Inferring workers' emotions with AI has been banned since 2 February 2025, except for medical or safety reasons.
- New York City's Local Law 144 requires a bias audit and notice to candidates before an automated employment decision tool is used.
- California's privacy agency adopted rules in 2025 on automated decisionmaking technology used for significant decisions, including employment.
Expect to need a data protection impact assessment (Article 35), and raise all of this with your DPO or counsel before go-live, not after. One rule is purely technical: access ends when employment ends. Tie the app to SSO groups so disabling an account removes access everywhere, and rotate any keys a departing employee created.
Where the app should run
| Option | Fits | Watch out for |
|---|---|---|
| The builder's public hosting | Prototypes with fake data | Public URLs, keys stored on the platform |
| Your own server behind SSO | Internal tools with real data | You patch it, monitor it and back it up |
| A private network over VPN | HR and finance tools | Staff need VPN access to use it |
For the second and third options, a small Cloud VPS behind a cloud firewall that only admits your VPN or your sign-in proxy keeps the tool off the open internet. Keep the database listening on localhost or a private address, never on a public port.
The go-live checklist
- No secrets in the bundle or anywhere in Git history.
- Every table has access rules, tested as a second ordinary user.
- Every page and API route returns
401,403or a login redirect when signed out. - Integration keys are scoped, one per tool, with an expiry date.
- Logs hold IDs, not records; the model provider's data terms are checked.
- The database is unreachable from the internet (
ss -tlnpon the server shows what listens where). - A named owner, a company-owned repository and a backup you have restored once.
- Sign-off from compliance for anything touching HR or finance data.
FAQ
Is an unguessable URL enough protection?
No. Links get forwarded, logged and indexed, and anyone who has one gets everything behind it. Require sign-in on every route, and treat the URL as public.
Can we build with a copy of real data?
Use synthetic or masked data while building, especially inside AI chat tools, which may keep what you paste. Switch to real data only after the checklist passes, on the server where the app will run.
Does the EU AI Act apply because we built the app with AI?
Building with an AI assistant does not make the result an AI system. What matters is what the app does: a leave tracker written by an assistant is ordinary software, while a tool that uses a model to rank job applicants falls in the high-risk employment category.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




