Why a file, and why before the upload
Support desks and AI assistants increasingly ask for the whole file: a 40 MB application log, a .env to explain a startup error, or a HAR capture of a failing login. An AI chat cannot mask a file for you, because by the time it could read it, the file has already been sent. A HAR capture is the worst case: it records every request header, so it holds your live session cookies and Authorization: Bearer tokens, which are enough to sign in as you until they expire.
How a big file is masked without splitting a secret
The file is read in 4 MB slices and masked by a background worker, so the page stays responsive and the progress bar moves. A first quick pass only looks for text that already has the shape of a placeholder, such as [EMAIL_1], so the masker never issues one that is already in the file and un-masking can never change a line you did not mask. The second pass masks.
- Text is masked in chunks of about 256 KB that end only at a line break. The partial last line is carried into the next chunk. A single line longer than a chunk, such as minified JSON, has to be cut inside the line, but never inside a value a rule has found, and the next chunk still sees the text before the cut.
- If a
-----BEGIN … PRIVATE KEY-----block has started but itsENDline has not arrived yet, the whole block is carried forward until it has, so a key is always hidden as one [PRIVATE_KEY_1]. - Each chunk also sees the previous 2 KB of lines as context. A rule that needs a nearby word, such as a US Social Security number that is only masked when
SSNstands within 40 characters before it, works across the chunk edge too. - One placeholder list covers the whole file: an address that appears on line 3 and line 900,000 is [EMAIL_1] both times, so the AI can still see it is the same person.
The same 242 detectors as the paste box run on every line: cloud and API keys (including 196 provider key formats ported from gitleaks), wallet recovery phrases, JWTs, private keys, bearer tokens, cookies, passwords in config lines and connection strings, e-mail addresses, phone numbers, IBANs, card numbers, twenty-one national ID numbers, IP and MAC addresses, internal host names and the user names in file paths. Each rule, with what it deliberately leaves alone, is listed on the secret types page. On a sparse application log, the engine masks roughly 10 MB a second on one core of a typical server CPU; a phone is slower, and a log with a secret on every line is slower too.
What happens to a Word, Excel or PowerPoint file
A .docx, .xlsx or .pptx file is a ZIP archive of XML files. The page recognises one by the ZIP signature and the [Content_Types].xml list inside it, not by the file name, unpacks it in the tab with its own ZIP reader, and runs the same detectors and your word list over:
- Word: the body, headers, footers, footnotes, endnotes, text boxes, comments, tracked deletions (text you deleted with Track Changes on is still in the file, word for word) and the addresses of external links;
- Excel: every text cell (shared and inline strings), cell comments and threaded comments, page headers and footers, and the text copies a pivot table keeps;
- PowerPoint: slides, speaker notes and comments;
- all three: the document properties that travel with the file and that you rarely see, such as author, last modified by, title, subject, keywords, company and manager, and the names and account ids of the people who commented or tracked changes.
Word breaks a line of text into pieces called runs whenever the formatting, the spell-check state or the editing session changes, so a key you pasted and then partly re-typed can be stored as AKIA in one run and the other 16 characters in the next. A masker that looked at each piece alone would see neither half as a key. Here each paragraph (and each Excel cell) is read as one string first; the placeholder goes into the run where the match starts, and the other runs lose the matched characters:
<w:r><w:t>Deploy key AKIA</w:t></w:r><w:r><w:rPr><w:b/></w:rPr><w:t>Z7Q3LMN4PQR8STU2</w:t></w:r> → <w:r><w:t>Deploy key [AWS_KEY_1]</w:t></w:r><w:r><w:rPr><w:b/></w:rPr><w:t></w:t></w:r>
Only text changes. No paragraph, run, cell or slide is added or removed and no formatting changes, so the masked copy opens in Word, Excel or PowerPoint and looks like the original with placeholders in it; a placeholder takes the formatting of the run where the match started. Parts that are not scanned, such as pictures, are copied byte for byte. The masked copy is named like contract.masked.docx, and the mapping and the answer box work exactly as for a text file.
What happens to an OpenDocument file
LibreOffice and OpenOffice save .odt (Writer), .ods (Calc) and .odp (Impress) files, and so can Word, Excel, PowerPoint and Google Docs on request. An OpenDocument file is also a ZIP of XML files; the page recognises one by the mimetype entry that comes first in the archive, not by the file name, and masks:
content.xml: every paragraph and heading of the body, table cells, text boxes, slides and speaker notes, footnotes and endnotes, comments (office:annotation), text deleted with Track Changes on, and the addresses of links;styles.xml: the page headers and footers, which Writer keeps apart from the body;meta.xml: the author (meta:initial-creator), the person who last saved it (dc:creator), title, subject, keywords, description, custom properties and the path of the template it came from;- in a spreadsheet, cell values typed as numbers are scanned: the number is stored twice, as the text you see and as
office:value, and both are checked. When a rule matches a number (a card number typed into a cell as a number, which passes the Luhn check, say), both copies become the placeholder, so that cell is no longer a number in the masked copy and formulas that use it will not calculate as before. Dates, times and true/false values are not scanned.
Writer keeps text as mixed content: when part of a line is bold, or a comment is anchored in the middle of a word, the text is split around a text:span or a comment marker. Each paragraph is therefore read as one string across all its spans, the placeholder goes into the piece where the match starts and the other pieces lose the matched characters, as for Word:
<text:p>Deploy key AKIA<text:span text:style-name="T1">Z7Q3LMN4PQR8STU2</text:span></text:p> → <text:p>Deploy key [AWS_KEY_1]<text:span text:style-name="T1"></text:span></text:p>
The masked copy keeps every entry in its original order, with mimetype first and uncompressed as the OpenDocument standard requires (ODF 1.3 Part 2, section 3.3), so it is still a valid OpenDocument package; no element or attribute is added, removed or moved. One part is changed on purpose: Thumbnails/thumbnail.png, the small preview of the first page that LibreOffice saves with every file, shows the original, unmasked text, so the masked copy carries a blank one instead.
The people named in the file are listed after masking, with where each name was found: the document's author, the last person to save it, and everyone who commented or tracked a change. A name has no check digit and no fixed shape, so it is only hidden when it is on your word list; the list tells you which ones are still visible and offers one tap to hide each.
What happens to a PDF
Payslips, bank statements, contracts and invoices are usually PDFs, and they are the documents that carry the most personal data per page: a CPR or social security number, an IBAN, a home address, a salary. A chat that is handed the PDF reads all of it the moment it is uploaded. Here the PDF is opened in the tab with pdf.js, Mozilla's PDF reader (version 6.3.289, served from this site; about 1.8 MB, loaded only when you drop a PDF, never on a plain page view). It reads the text layer of each page, the characters the PDF stores with their positions, and rebuilds the lines from those positions: a new line where the PDF ends one or where the next piece of text sits on a different baseline, a space where two pieces on one line are visibly apart. That text goes through the same detectors, your word list and the names and addresses suggestions as a text file, with one placeholder list for the whole document.
===== Page 1 of 2 ===== Onboarding letter, September 2026 Employee: Maria Jensen Temporary AWS key [AWS_KEY_1] expires Friday. ===== Page 2 of 2 ===== Questions: [EMAIL_1] Employee CPR: [CPR_1] Start date: 1 October 2026
That is the whole output: text with a separator line before each page, which you copy or download as onboarding.masked.txt, next to a count per page (“Page 2: 1 e-mail address, 1 Danish CPR number”). Paste it into the chat instead of attaching the PDF. The mapping and the answer box in step 2 work the same as for any other file. The name in the example is not hidden until you tap it under “Also found”, because a name has no check digit.
Where it falls short, concretely:
- A value that wraps. When a PDF breaks a long key or an IBAN over two lines, or hyphenates a word, the two halves come out on two lines, and a rule that needs the whole value may not match. Skim the text for anything that wrapped.
- Letter-spaced or oddly encoded text. Some PDFs place every letter separately or map their fonts to the wrong characters; the text then comes out spaced (
M a r i a) or garbled, and garbled text cannot be matched. What you see in the box is exactly what the rules saw. - Scans and pictures. A scanned payslip is a picture of text with no text layer. The page reports it (“Page 3 has no text layer (probably a scan), so nothing on it was read”) instead of silently returning nothing. Run OCR in a tool you trust first if you need those pages.
- Passwords. A PDF that needs a password to open is named and not read. A PDF that only restricts printing or copying (an owner password) opens without one, so it is read normally.
What happens to a screenshot
A screenshot of a terminal, a cloud console or an error dialog is the easiest way to show an AI chat what went wrong, and the easiest way to hand it a key: the AWS_SECRET_ACCESS_KEY in an env listing, the e-mail address in the corner of a dashboard, the card number on a checkout page. The usual fix is to blur or pixelate it by hand in an image editor, which is slow and not always enough: pixelated text in a known font can be recovered by rendering candidate strings and comparing the blocks (the open-source Depix tool does exactly that). Here every box is solid black, and the pixels under it are replaced, not smudged.
When you drop or paste a PNG, JPEG or WebP (a GIF or BMP works too), the browser decodes it and tesseract.js 7.0.0 reads the text on your device: a WebAssembly build of the Tesseract OCR engine with the “fast” English model from tessdata_fast, all served from this site (5.8 MB the first time). Small screenshots are scaled up to twice their size before reading, because Tesseract reads 11-pixel interface text poorly. The words it finds are joined into lines of text, the same 242 detectors and your word list run on that text, and every hit is traced back to the boxes of the characters it came from:
OCR text AWS_ACCESS_KEY_ID=AKIA…MPLE (one word to the reader) hit AKIA…MPLE, characters 18 to 37 box only those 20 characters, from their own boxes, plus a margin
A card number read as four words on one line gets one box across all four. Then you check the picture: tap a box to lift it if it hides something harmless, drag to add one over anything the reader missed (a name, a face, a QR code). The download, screenshot.redacted.png, is drawn fresh from the canvas and encoded as a new PNG, so the original's metadata does not come with it: no EXIF camera or GPS data, no creation time, no editing software tags. You also get the text the reader saw, masked with placeholders, and a mapping so the chat's answer can be restored in step 2.
What to expect from the reading, concretely: sharp screenshots of dark text on a light background at normal interface sizes are read well; light-on-dark terminal text is often read too (Tesseract retries a line inverted when it reads it with low confidence), but check those boxes closely. Phone photos of a screen, text under about 10 pixels high, heavy anti-aliasing, italics and decorative fonts go wrong often. Recognition takes a few seconds for a laptop screenshot on a laptop and longer on a phone. It is only as good as what the reader saw, so the text box shows exactly that.
What happens to a HAR file
A .har file, or a .json file that starts with {"log": the way browsers export a HAR, is masked by field as well as by pattern, because a session cookie called sid with a random value has no pattern to find:
- request and response header values for
Cookie(every value, names kept),Set-Cookie(the value, attributes kept),AuthorizationandProxy-Authorization(the credential, the scheme kept), and any header whose name containstoken,api-key,apikey,secretorsession; - every
request.cookies[].valueandresponse.cookies[].value; queryString[]andpostData.params[]values whose name contains one of those words orpassword,credentialorsignature, and the same parameters insiderequest.url,redirectURL,LocationandRefererheaders, and a form-encodedpostData.text;- every other string, including response bodies, through the same detectors as a text file.
"url": "…/v1/me?access_token=q8Zt…&lang=en"
→ "url": "…/v1/me?access_token=[SECRET_1]&lang=en"
{"name": "cookie", "value": "sid=8f3a9c…; theme=dark"}
→ {"name": "cookie", "value": "sid=[COOKIE_1]; theme=[COOKIE_2]"}
{"name": "authorization", "value": "Bearer eyJhbGciOi…"}
→ {"name": "authorization", "value": "Bearer [BEARER_1]"}
The same value keeps the same placeholder everywhere, so the token in the URL and in queryString are both [SECRET_1]. Only the text inside strings changes: the masked HAR is still valid JSON with the same structure, and it opens in a HAR viewer. A HAR file is read into memory whole, so a very large capture needs a browser with memory to spare; plain-text files are streamed.
The download and the mapping file
The masked copy is named after the original with .masked before the extension: app.log becomes app.masked.log, capture.har becomes capture.masked.har. The mapping is a separate JSON file listing each placeholder and the exact text it replaced. You only need it if the tab is closed before the AI's answer comes back: load it in step 2 and the answer restores exactly as it would have in this tab. For a UTF-8 file, un-masking the whole masked copy with its mapping gives back the original byte for byte; that is how this page is tested, on a 50 MB log and on a HAR capture.