DEV Community

Cover image for What would "zero-trace file sharing" actually take? My notes so far.
Songke
Songke

Posted on Edited on

What would "zero-trace file sharing" actually take? My notes so far.

Start with the threat model, not the tool

I got annoyed this week and couldn't shake it, so here are my notes.

The annoyance: every "secure file sharing" tool I reached for solves a different problem than the one I actually have. They encrypt the bytes in transit — fine — but they leak everything around the bytes. My name, my company, the revision count, the original filename, the fact that I uploaded anything at all. And in most cases "zero-knowledge" turned out to mean "we deleted it from our database after we finished storing it."

So I've been working out, on paper, what actually traceless file sharing would have to guarantee. Not building yet — I'm traveling for work this week, and my code is currently being "written" by my cat, who has strong opinions about the keyboard and has so far shipped one (1) pull request consisting entirely of the letter "a". More on that at the end.

The design is what I keep coming back to, and I want the threat model written down before the implementation, because that's the order it should be in. Here's where I've got to so far.

Requirement 1: the file must never exist on a server

"Encrypted at rest on our servers" is still on our servers. If the plaintext is assembled anywhere I don't control, I'm trusting that operator's access controls, their employees, their subpoena response, their breach disclosure timeline.

The only version of this guarantee I actually believe is: the file is never uploaded, in any form, to anyone's backend. That pushes the entire pipeline into the browser — read via the File API, process in-memory, and the moment the tab closes, the garbage collector takes it. "Deleted" becomes a physical fact, not a database row somebody promises to drop.

Requirement 2: the key and the ciphertext must travel different channels

This is the part most single-tool solutions get wrong, and it's the crux of the whole design.

If you send me an encrypted file and the key to decrypt it through the same message, the encryption is decoration. Intercept that one channel, you have both halves. Plenty of "encrypted sharing" tools are exactly this.

So the rule I'm designing around: the key and the ciphertext take completely separate paths.

  • The ciphertext (a few MB of AES-256 noise) goes peer-to-peer, browser to browser. A tiny signaling server introduces the two peers and then gets out of the way — it never allocates a single byte for the file.
  • The key (64 hex characters, ~64 bytes) goes through a different channel entirely: a one-time, self-destructing text link. Read once, then gone.

An adversary now has to compromise two independent channels to get anything, and the two channels have opposite shapes — one is fat, reusable, and peer-to-peer; the other is tiny, ephemeral, and single-use. That asymmetry is deliberate. I'm not aware of a cleaner way to get this property without making the experience miserable.

Requirement 3: clean the metadata before anything else

Order matters, and it's easy to get backwards. You can't scrub metadata from ciphertext — once it's encrypted it's uniform noise. So cleaning has to be step zero, on the plaintext, in the browser.

Office files and PDFs are ZIP archives of XML. The trail lives in plaintext inside docProps/core.xml — the author, the company, GPS coordinates, revision history. The approach: unzip with JSZip, blank those nodes, drop customXml (often where the sneakier tracking hides), re-zip.

One thing I already know from prototyping this: don't regex the XML. Word writes the same field a dozen different ways — with a trailing space, with a namespace prefix, self-closing. Pattern-matching silently misses older files. Parse it with DOMParser, mutate the nodes, serialize it back. Regex here is a bug farm.

const zip = await JSZip.loadAsync(await file.arrayBuffer());
const core = await zip.file('docProps/core.xml').async('string');
const doc = new DOMParser().parseFromString(core, 'application/xml');
doc.querySelectorAll('dc\\:creator, cp\\:company')
   .forEach(el => (el.textContent = ''));
zip.file('docProps/core.xml', new XMLSerializer().serializeToString(doc));
Enter fullscreen mode Exit fullscreen mode

Requirement 4: the guarantee has to survive a hostile network

WebRTC peer-to-peer is great until it isn't. Symmetric NAT and corporate firewalls can't always connect directly — that's roughly 10–20% of real-world sessions, and the standard fix is a TURN relay, which means your file transits a server after all.

I haven't fully decided how to handle this honestly. The tempting move is to silently fall back to relaying and keep calling it "zero-contact." I don't love that — a privacy promise you have to quietly qualify is a promise users stop trusting. My current leaning: surface it. Tell the user "your network can't do a direct connection" and let them decide whether to proceed via relay or abort. Still working out whether that's the right call or just the honest one.

I'm also deliberately capping file size — 5MB in my current notes. Under that, peer-to-peer connects almost always succeed, the transfer takes 1–2 seconds, and you can stay off TURN entirely, which is what makes "the server never sees it" a true statement rather than a marketing one.

Where this leaves me

None of this is finished. The metadata cleaner is the only piece I've actually prototyped; the peer-to-peer transfer and the one-time key channel are still "this is the design I'm building toward." I'm writing the threat model down first precisely because I don't want to ship a feature and then rationalize its security.

The shape I'm converging on: a chain of small browser-local tools rather than one monolithic "privacy platform." Clean → encrypt → send the key one way → send the ciphertext another way → decrypt. Each step is simple and auditable on its own; the interesting property — that no single point of failure exposes the file — only emerges when you chain them.

I'm collecting this whole line of thinking at ProToolNest — the working title for the suite of browser-only utilities I'm assembling around exactly this "nothing gets uploaded" constraint. Alongside the secure-transfer chain, I've also been stocking the site with the smaller utilities I find myself reaching for every day — format converters, encoders and decoders, that kind of thing — mostly so the place isn't a ghost town while I finish the harder pieces. Nothing there is finished-finished yet, but the threat model above is the spec I'm building to.

One thread I'm leaving for next time

There's a harder version of this problem I haven't touched here: what if the file needs to stay private for years, and outlive the website that sent it? My current sketch involves Shamir's Secret Sharing (split the key so losing one fragment doesn't destroy the file) plus a self-contained HTML decryptor you can double-click in a decade with no server and no internet. That's a whole post of its own — the "browser crypto doesn't run on a double-clicked file" problem alone is a trap worth writing up separately. Next time.

If you've thought about any of this — especially TURN fallback without lying to the user, or those messy OOXML edge cases — I'd genuinely like to know what I'm getting wrong. That's most of why I'm writing it down in public.

Top comments (0)