Why we never store the value we found
When DOCNUS finds a passport number in one of your documents, it does not store the passport number.
It stores a masked rendering of it, the page and character range where it sits, and a salted keyed hash. The value itself is read back out of your own document, on demand, by someone who could already open that document.
This is a departure from how the rest of the product stores extracted data, and it was a deliberate one.
The thing we were about to build
The obvious design is a findings table. One row per detected item: category, value, document, location. It is easy to build, fast to query, and makes every feature you might want trivial — search across findings, dedupe by value, show the user exactly what was found.
Then you look at what that table actually is.
It is every national identifier, tax number, bank account and health condition across a customer's entire document estate, extracted from wherever it was buried and collected in one place, indexed and ready to query. The source documents were already sensitive, but they were also scattered, unstructured, and individually access-controlled. The findings table removes all three of those protections at once.
We would have spent a year building a privacy product whose own database was the most attractive target in it.
Two consequences, one of them non-obvious
The first is the ordinary breach argument. If that table leaks, the blast radius is not "some documents" — it is a clean, structured export of every piece of regulated data a customer holds, pre-sorted by category. There is no version of that incident that is survivable.
The second took longer to see. A findings table containing personal data about your customers' data subjects is itself personal data that we process. Which means it is discoverable in a subject access request made against us. Someone exercising their right of access could compel disclosure of an index we built of them, assembled from documents they never gave us. Building it would have created a legal obligation that did not previously exist, for both us and our customers.
What gets stored instead
Three things, none of which is the value:
A masked rendering. Enough to recognise the item in a list, not enough to use it. This is what the UI displays.
A location. Page number, and the character range in the extracted text. This is what makes the finding actionable — you can jump straight to it in the document.
A keyed fingerprint. A salted hash, used to recognise that the same value appears in another document. This is what makes cross-document matching possible without retaining anything to match against. The key lives in the environment, never in the database, so the fingerprints are not reversible from a database copy alone.
To see the real value, you open the document. Which requires permission to open the document. The authorisation you already had is the authorisation you still need — no new path to the data was created.
What it costs
Being straight about the trade, because there is one.
You cannot search findings by value. "Show me every document containing this specific passport number" only works if you have the number to hash, not as browsing. Fuzzy matching across near-identical values is out — hashes match exactly or not at all. And any feature that wants to reason over the raw values has to go back to the source documents, which is slower and needs the caller's permissions.
We took those costs. Most of them turn out to be features you should not want: a privacy tool that lets you browse a list of everyone's identifiers has reinvented the problem it was sold to solve.
The general principle
The useful question when designing a system that touches sensitive data is not "how do we secure this store?" It is "what happens to our customers if this store is fully compromised?" — and then, if the answer is unacceptable, changing what the store contains rather than adding another control on top of it.
Encryption at rest, access controls and audit logging are all necessary. They also all fail in the same scenario: an attacker with legitimate-looking credentials. The only defence that survives that is not having the data.
Detection indexes are a good place to apply this, because the value is almost never what you needed. You needed to know that something is there, what kind it is, and where to look. All three survive the value being thrown away.