WritingSecurity

End-to-end encryption on the web has a code delivery problem

If the server ships the JavaScript that holds your keys, what does end-to-end encryption on the web actually promise? Signed releases, SRI, worker isolation, and their honest limits.

Flavian Ene4 min read

There is a standard objection to end-to-end encryption in a web application, and it is correct.

The browser downloads the code that generates and holds your keys from the same server that the encryption is supposed to protect you from. If that server is compromised, or compelled, it can serve a modified bundle to one person on one day, capture their keys, and leave everyone else untouched. Native apps have code signing and app-store review, with their own problems. On the open web, by default, you run whatever the origin sends you.

Henedo runs entirely in the browser (there is no native app), so I had to decide what to claim, and what to build to make the claim as strong as it can honestly be.

What web E2EE does protect

It is worth being precise, because the objection is often stretched into "web encryption is pointless", which is wrong.

Most real breaches are not targeted code substitution. They are a database dump, a public storage bucket, a leaked backup, a compromised admin account, a curious insider running a query. Against all of those, content encrypted in the browser under keys the server never held is simply unreadable. In Henedo that covers files and photos, their names and previews, where and when a photo was taken, journals, recordings, wills, and the answers relatives send back.

What it does not protect, on its own, is the code path. So the rest of the work is about shrinking that gap and making any abuse of it detectable.

Layer one: keep hostile script off the origin

The first defence is a strict Content Security Policy, sent as an HTTP header: default-src 'none', script-src 'self' 'wasm-unsafe-eval', no third-party script hosts at all, frame-ancestors 'none', and network connections limited to Henedo's own origin, its database and storage, and a short list of map and place-search services.

The stricter rule is architectural. The origin that holds unlocked keys never runs third-party script. Bot protection runs in a frame on a separate subdomain. Analytics, if a visitor accepts them, run in a sandboxed frame on another subdomain that receives cleaned page addresses and never documents or storage. Pages opened from a private link are never measured.

Layer two: keep the key out of the page

The Master Key is generated and used inside a dedicated Web Worker. The page holds an opaque handle; the key leaves the worker only as ciphertext under a key the worker derived itself.

This is defence in depth, not a wall. Hostile code running in the page can still ask the worker to perform legitimate operations, or read content after it has been decrypted for display. What it cannot do is lift the raw key and walk away with it, which narrows a compromise from "everything, forever" to "whatever can be done while the vault is unlocked".

Layer three: make releases checkable

The real answer to "the server could ship you something else" is to make something else detectable.

Every production build of Henedo lists the SHA-384 hash of every HTML, JavaScript, CSS and WebAssembly file in a manifest. The manifest is signed with an Ed25519 key that is kept offline and never placed on a build server. The hosting pipeline only verifies a signed candidate and promotes its exact bytes, and every script and stylesheet tag carries a Subresource Integrity attribute. The transparency page explains how to check the files you were served against the signed manifest, and the verification key is published at a well-known path.

The effect is that a compromised build server or CDN cannot quietly change what users run. Modified files no longer match a signed manifest, and anyone can check.

What this still does not solve

This is the part most security pages leave out.

  • A malicious release signed with the real key is not detected by the signature. Signing proves who released something, not that it is benign. What the public record adds is that such a release would exist in the open, for anyone to inspect, rather than being served to one person and forgotten.
  • A first visit has nothing to compare against. Trust on first use is still trust.
  • Malware on the user's own device can capture what they type and see. No online service can prevent that.
  • The release signature is classical. Henedo's sharing and delivery signatures are already hybrid with ML-DSA; the release manifest is still Ed25519 only. A post-quantum release signature is on the list, not done.

Henedo's security document lists each of these as a known limit, in the same plain language as the guarantees.

Where this goes next

The underlying fix belongs in browsers: a way for a web application to commit, publicly and verifiably, to the exact code it serves, with the browser refusing anything that does not match. Until that exists as a standard, a signed manifest, strict isolation of the key-holding origin and a public record of releases are about as far as a web service can go.

The broader point applies to any product making privacy claims. "We can't read your data" should come with its conditions attached: as long as the code you run is the code we signed, and here is how to check. A precise claim with its limits stated is worth more than a broad one that a careful reader can take apart.

  • e2ee
  • web-security
  • csp
  • sri
  • transparency
  • henedo

Flavian Ene

Founder and CEO of Henedo, founder of nordo. MSc in Cybersecurity. Writes about security-first ventures, AI systems and what did not work. About