Privacy rules held by code
Why a rule that matters cannot be a request to a model, the order of checks that lets an excluded window leave no trace, how secrets are removed before anything is written, and how deleting stays deleted when there is a search index.
- Explain why a privacy rule must be code that runs before anything is written, and not an instruction to a model.
- Order the checks in a recorder so that an excluded window leaves no trace at all.
- Remove secrets from text by their shape, and say what such removal misses.
- Make a deletion hold when there is a search index and a retention window.
3.1The problem: a recorder sees everything
A program that reads the window in front of its owner will, sooner or later, be looking at a password manager, a bank statement, a private browser window and a one-time code. What happens next cannot depend on judgement. A language model asked to "ignore anything sensitive" will usually do so, which is not the same as always.
- Held by code
- A rule is held by code when one function decides it, the function runs before the thing it guards against can happen, and a test fails if the function is removed.
3.2The order of checks
The recorder is one loop. What matters is the order of its steps, because a check that runs after the title has been written is too late.
- Paused? Then nothing is read and nothing is written. A pause file that cannot be parsed counts as paused.
- Which window? Program and title; for a browser, the address and whether the browser's own badge says the window is private.
- Excluded? Then the open span is closed and the pass ends. Nothing about the window is written: not its name, not its title, not that time was spent there. The timeline has a gap.
- Only then the title with secrets removed, the text, and the field being typed in.
def excluded(self, app: str = "", title: str = "", url: str = "") -> str | None:
"""Why this window must leave no trace, or None."""
a = (app or "").lower().removesuffix(".exe")
if a and any(fnmatch.fnmatch(a, g) for g in self.apps):
return "app"
if title and any(r.search(title) for r in self.titles):
return "title"
host = host_of(url)
if host and any(fnmatch.fnmatch(host, g) for g in self.hosts):
return "site"
return None
Three lists feed it: programs, title patterns and site patterns. They are data. The built-in lists cover password managers, Windows' credential prompts, private browser windows, banks, brokerages, payment sites and the sign-in pages of identity providers. What the owner adds is joined to the built-in lists, so a mistyped settings file cannot switch off the exclusion of password managers.
Two smaller rules follow from the same idea. A browser whose address cannot be read is treated as unknown: its title is recorded and its text is not, because the address is how a bank is recognised. And if the window changes while its text is being read, what was read is thrown away, because it may belong to something not yet checked.
3.3Secrets, removed by shape
Excluding a window is not enough. A key can be on screen in a terminal, a card number in an email. So every piece of text passes through one function before it is written, and what looks like a secret is replaced by a mark saying what kind it was.
| Kind | Recognised by |
|---|---|
| Keys and tokens | the prefixes vendors use, signed tokens in three dotted parts, anything after "Bearer" |
| Passwords and secrets in settings | a name such as password, secret, token or api key, then a colon or equals sign, then a value |
| Card numbers | 13 to 19 digits that pass the check-digit test cards use |
| Bank accounts | the international format with its own check, or digits following a word such as account or routing |
| One-time codes | 3 to 8 digits shortly after a word such as code, OTP or PIN |
| Identity numbers | the formats of several countries' numbers |
| Any long number | 11 to 19 bare digits |
| Random-looking strings | 32 or more characters with high entropy |
It errs towards removing. Nothing can tell an account number from an order number, and losing an order number costs nothing. On 26 made-up secrets all 26 were removed, with no change to 20 ordinary lines that contain numbers. Verified on that set; a secret with no recognisable shape, such as a password typed into a chat, is not caught.
Web addresses lose their query string, fragment and sign-in part before they are stored: a query can carry a token, a search or a document key.
3.4Deleting, and staying deleted
Raw records older than the retention window (14 days by default) are deleted; the distilled model is kept. The owner can also forget the last few minutes by command. Both are easy until there is a search index, which is a second copy.
The index is therefore treated as a cache. When anything is deleted from the raw files, a marker is left; the next time the index is touched it is thrown away and built again from what remains. A test writes a word, searches for it, forgets it, and then reads every byte of the raw folder and the index file to check that the word is gone.
The data folder itself may not be inside a synced folder. The program refuses to start if it is, because a folder that syncs is a folder copied to someone else's computer.
The test that checks a forgotten word is gone from the whole folder failed, correctly: the word was in the access log, as the search a client had made for it. The log is meant to keep what was asked. The test now checks the raw files and the index, and the log is left alone. Whether a question is itself something to forget is a decision the owner has not been asked to make yet.
- A rule that matters is a function that runs first, with a test that fails without it.
- Pause, identify, exclude, and only then read. An excluded window leaves a gap, not a record.
- Secrets are removed by shape before writing, erring towards removing.
- An index is a cache: delete from the source, then rebuild.
- The title rule excludes any window whose title mentions net banking. Give an ordinary window it would wrongly exclude. Is that the right direction to be wrong in?
- The recorder leaves a gap where an excluded program was in front. What does the length of a gap reveal? Design a way to hide it and name what that would cost.
- Write a secret that the removal function would miss, and one ordinary string it would wrongly remove.
- Extend the code: let the owner mark a site as "titles only". Where in the order of checks does it go?