Scrub Before You Store¶
Learning objectives
- Why redacting sensitive data when you display it leaves it exactly where the risk is
- The difference between hiding something and not having it
- Why one retention policy over two different kinds of record is wrong in both directions
- How to keep an incident reconstructible after you have deliberately thrown away its contents
- Why a console that grants power should record its own use — and what that does and does not prove
- The habit of checking a licence at the feature you need, not at the project's headline
Two questions that sound like plumbing¶
Every platform eventually asks itself two operational questions. How do we see what went wrong? and how do our operators act on the system safely? They arrive looking like infrastructure chores. In a system that reasons over other people's documents, they are neither — they are the two places where a platform is most likely to quietly accumulate a liability.
The first question is about telemetry. The second is about privilege. This post is about a mistake that is easy to make in each, and both mistakes share a shape: a control placed at the moment of display rather than the moment of storage.
The redaction that redacts nothing¶
Here is a design that sounds careful and is not.
An operator opens a troubleshooting console to investigate a failed request.
The console shows the request's journey — where it entered, what policy
decided, what the reasoning steps were, what came back. Sensitive parts of the
content are replaced with a marker: this operator does not have clearance to
read that, so they see [REDACTED] instead.
That is a real control, and it is doing real work. It is also, on its own, close to useless for the risk you actually carry.
Because the question is not what did the operator see. The question is where does the sensitive content live. And in that design it lives in the log store, in every backup of the log store, and in whatever long-term archive the log store feeds. It was never removed. It was covered up at the last possible moment, on one path, for one viewer.
Now enumerate the paths that do not pass through that viewer. A backup restored into a staging environment. A storage bucket misconfigured for a day. A subpoena that asks for logs rather than for screenshots. An engineer with database access rather than console access. In every one of them the content is simply there, in the clear, and the redaction never runs.
The fix is not a better redactor. The fix is to move it.
Not having it beats hiding it¶
Put the scrubbing between the collector and the store, so that what gets written was never sensitive in the first place. The pattern is a small pipeline: strip the fields you know are sensitive, catch the ones you can recognise by shape, and reduce free text to something that preserves its usefulness without preserving its content — a hash, a length, a category.
Then the guarantee changes character entirely. Before, the guarantee was "our console does not show this to unauthorised people," which is a statement about one program's behaviour. After, it is "this is not in the store," which is a statement about the world. The first requires you to trust every future reader. The second does not.
Keep the display-time check as well. Two independent controls, one at ingest and one at read, are not redundant — they fail differently. What you must not do is move the read-time check to ingest and call it done. You had one control; you should end with two.
The test that proves it
The acceptance criterion writes itself, and it is one you cannot fake: push a synthetic record containing a distinctive sensitive value all the way through the system, then go looking for that exact value in the store, in a backup of the store, and in the archive. Finding nothing is the pass. A design that redacts at display time fails this test immediately — which is precisely why it is worth running.
One retention policy, two kinds of record¶
The second mistake hides inside a reasonable-sounding sentence: we keep logs for a fixed period to satisfy our audit obligations.
The problem is that "logs" is two different things wearing one word.
There is the record of what happened: a request arrived, a policy decided, an operator took an action. That record is evidence. It wants to be long-lived and immutable, because its whole value is that nobody can revise it afterwards.
And there is the working detail: the content of the request, the arguments passed around, the text a person typed. That is diagnostic material. Its value decays within days — nobody debugs last quarter's request from raw content — and its risk does not decay at all.
Apply one policy to both and you are wrong in both directions at once. The window is too short for evidence, because a long audit horizon needs records that outlive it. And it is far too long for content, because data-protection practice everywhere converges on the same instruction: keep personal data no longer than the purpose requires, and be able to say what the purpose was.
So split them. Keep the evidence long and sealed. Keep the content briefly, and let it go. The interesting part is what makes this safe.
Throwing things away without losing the thread¶
The obvious objection to short-lived content is that it destroys your ability to investigate anything historical. It does not, if you link the two classes before you delete one.
Give every piece of working detail a stable identifier derived from its content, and record that identifier in the sealed evidence. When the content expires, the evidence still holds the shape of the incident: what happened, in what order, who acted, and a durable reference to material that no longer exists. You can still reconstruct the narrative. You simply cannot reread the text — which was the point.
This is a genuinely pleasant property to design for. It turns "we deleted it" from a gap in the record into a stated fact in the record.
The console that records itself¶
The privilege question has the same shape as the telemetry one.
Any serious platform ends up with an administrative surface: rotate a credential, revoke an identity, widen a permission, trigger a backup. That surface concentrates power, and the temptation is to treat the concentration as the achievement — one place to do everything.
But a console that grants power silently is an amplifier, not a control. What turns it into a control is unglamorous and mostly bookkeeping:
- Distinct identities. Every workload and automated agent holds its own, scoped to what it actually needs. Shared credentials make the audit trail meaningless before you have written a line of it.
- A second pair of eyes on the actions that are hard to undo, and on anything that crosses a boundary.
- Emergency access that is time-boxed and reasoned. Break-glass should exist. It should also announce itself at the moment it is used, not appear in a review three weeks later.
- A record the actor cannot edit. Append-only, each entry sealed against the one before it, so that altering history is detectable rather than merely discouraged.
And then the part that takes discipline: be precise about what this proves.
It does not prove operators cannot see data. On a system where reasoning happens over plaintext on infrastructure somebody administers, that claim requires machinery of an entirely different order, and anyone asserting it casually is overselling. What the pattern above proves is narrower and still worth a great deal: privileged actions are constrained, and they are recorded in a form the person who took them could not rewrite.
Say the narrow thing. It survives scrutiny, and the broad thing does not.
A licence footnote worth internalising¶
One last habit, learned the tedious way.
When you choose an open-source component for a compliance-adjacent job, do not check the licence on the project's front page and move on. Check it at the specific feature you are relying on.
It is common, and entirely legitimate, for a project to be permissively licensed at its core while a handful of capabilities sit behind a commercial edition. What is worth noticing is which capabilities those tend to be. Very often they are exactly the ones a regulated deployment reaches for first: retention controls, audit logging, data masking, fine-grained roles.
Nobody is being sneaky. Those features are where the commercial value is. But if your architecture assumed them and your licence does not include them, you find out late, and the discovery is expensive. Read to the feature.
The mitigation is also the good engineering practice anyway: instrument against an open standard rather than a specific vendor's library, so the thing storing your telemetry is a component you can replace rather than a dependency you have married.
The takeaway
Controls belong where the data lands, not where a person happens to look at it. Scrub before you store, so the sensitive thing is absent rather than hidden. Keep the record of what happened long and immutable, and let the content go early — linking the two so that discarding the content does not discard the story. Give power a witness it cannot edit, then describe exactly what that does and does not prove. And check the licence at the feature, not the headline.