Skip to content
Detecti.ai

← All articles

· 5 min · by Gardien Security

"Looks like a CPF" versus "is one of our customers' CPFs": exact matching against your own list

The alert says: "eleven CPFs pasted into ChatGPT". CPF is the Brazilian individual taxpayer ID. The manager reads it and asks the obvious question: "are they ours?"

And nobody can answer. A CPF from a test dataset, the person's own CPF, a CPF copied from a public document and a customer's CPF all have exactly the same format: eleven digits, two of them check digits. The pattern detector sees all four the same way. It answers "looks like a CPF" with precision, and it cannot answer "is one of our customers' CPFs".

That distinction separates an alert from a case.

Pattern detection and what it does not know

Pattern detection is useful and necessary. It recognizes a CPF by its check digit, a CNPJ (the Brazilian company registration number) by its own, a card number by the Luhn algorithm, an email by its shape, a Pix key (Pix is Brazil's instant payment system) by the format of each key type. It runs on the machine and depends on nothing beyond the pasted text.

What it does not know is whether that value has any relationship with the company. To answer that, it has to compare against the list of who the customers are. And that is where the problem appears: nobody wants to send their customer list to the vendor of a monitoring tool.

How exact matching works

The solution has three parts.

  1. The company exports the list. CPFs, CNPJs, emails, Pix keys, whatever makes sense for the business. Only the identifiers, with no names, no addresses, no history.
  2. The server turns each value into a digest (HMAC, with a key that belongs to that customer alone) and discards the original. The digest allows checking whether two values are equal, and without the key there is no way back from it to the value. The server keeps only the digests.
  3. The agent compares on the machine. When someone pastes text into an AI tool, the agent finds the candidates by format, computes the digest of each one and checks whether it is in the list of digests. If it is, the "your customer's data" category is flagged.

The pasted text still does not go up; categories and counts do. The difference is that now one of the categories says "7 of the 11 CPFs belong to our customers".

Why the server never keeps the list

A customer list in a vendor's hands is a second copy of data that the LGPD, the Brazilian data protection law, requires you to protect with technical measures under article 46. Every copy is one more place where an incident can happen, and every incident is a notification to the ANPD, the Brazilian data protection authority, within three business days under Resolution CD/ANPD 15/2024.

Keeping only the digest removes that problem at the root: there is no table of customer CPFs on the server to leak. There is a table of digests, which serves a single operation, checking equality, and which is not the list.

It is worth being honest about the limit. A CPF or a CNPJ has a small number of possible values, and someone holding both the digests and that customer's key could try them all until they found the ones that match. That comes with checking an exact value without keeping the value, and the equivalent feature in Microsoft Purview has the same property. That is why the key is not stored in plain form on the server: it is kept encrypted with another key that does not live in the database, and whoever takes only the database takes only the digests. What changes is that the original list is never there.

What changes in the alert

Without exact matching, the alert "eleven CPFs in ChatGPT" is an interesting fact that needs investigation before it becomes anything. Someone will have to talk to the person to find out whose CPFs they were.

With exact matching, the alert "seven of our customers' CPFs in ChatGPT, a not approved tool" is already a case. It has severity, an owner, a deadline and a concrete question for the DPO: is this a security incident involving personal data under article 48, and does it need to be reported?

It also changes the correlation rule in the SIEM. "Your customer's data" in any quantity deserves an incident, while a generic CPF can wait for a threshold. And it changes the enforcement mode: you can block the paste only when the category is "your customer's data", and keep merely observing the others.

How to prepare the CSV

The list is simple, and simplicity is the point. A few practical rules:

A fictitious payments company, Norte Pagamentos, would export two columns, CPF and CNPJ, and nothing else. A fictitious law firm, Valente Advogados, perhaps only CPF and email. Each business knows which identifier shows up in daily work.

How this becomes a product

In Detecti.ai, "your customer's data" is one of the classification categories, alongside CPF, CNPJ, card number, credential, bank details, Pix key, health data, email and source code. The customer sends the list, the server keeps only the digests made with that customer's key and discards the text, and the agent tells "looks like a CPF" apart from "is one of our customers' CPFs" on the machine itself. The processing is described in /docs/privacy, and the list can be prepared during the pilot.

Read next