Privacy you can test: how Ahorreo enforces zero network calls

“Your data never leaves your device” is one of the easiest sentences to write on a landing page and one of the hardest to keep true over years of development. A single analytics snippet, an error reporter added during a late-night debugging session, a font loaded from a CDN: any of them quietly turns the sentence into a lie.

For Ahorreo, where the data is your bank history, we didn’t want privacy to depend on everyone remembering a rule. We wanted it enforced by the platform, checked by the test suite, and verifiable by you. This post explains the layers, with the actual policy and the actual test.

Layer 1: there is no backend

The strongest guarantee is architectural. Ahorreo is a fully static site: the build output is a folder of HTML, JavaScript and CSS that any static host can serve. There is no API, no database and no server-side code. Statements are parsed in your browser and stored in IndexedDB on your device. Why IndexedDB and not localStorage is covered in localStorage or IndexedDB.

The cost, which we accept openly: if you lose your device and have no backup, there’s nobody to recover your data from.

Layer 2: the browser enforces it

Architecture can drift, so the second layer lives in the HTTP headers. This is the Content Security Policy Ahorreo is served with, from public/_headers, one directive per line:

default-src 'self'
base-uri 'self'
object-src 'none'
frame-ancestors 'none'
form-action 'none'
script-src 'self'
style-src 'self' 'unsafe-inline'
img-src 'self' data:
font-src 'self'
connect-src 'self' https://data-api.ecb.europa.eu
worker-src 'self'
manifest-src 'self'

The line that matters most is connect-src. It’s the list of places JavaScript on the page may talk to with fetch, XHR, WebSockets or beacons, and it has exactly two entries: the app’s own origin and the European Central Bank’s public data API. If someone, someday, adds a request to an analytics endpoint, the browser refuses to send it.

The rest closes the other doors. script-src 'self' means no script from a CDN or an inline <script> someone pastes in. font-src 'self' means fonts are bundled. frame-ancestors 'none' stops another site from showing Ahorreo inside a frame, and form-action 'none' means no form can post anywhere. The same file sends Referrer-Policy: no-referrer and a Permissions-Policy that turns off geolocation, camera, microphone, payment and USB, none of which a finance app needs.

One directive is looser than the rest: style-src allows 'unsafe-inline', so inline styles are accepted. That affects how the page can be styled, not where it can send data; img-src, font-src and connect-src still decide that.

The build also writes the same policy into a <meta> tag in index.html (vite.config.ts), as a safety net if someone serves the built folder from a server without those headers. It’s only added to the production build, because the development server needs a WebSocket and inline scripts for hot reloading. The meta copy leaves out frame-ancestors, because browsers ignore that directive inside a meta tag; the header is what protects against framing.

Layer 3: the test suite enforces it

A CSP catches problems in the browser, which means in production. We want to catch them before a commit lands. So Ahorreo’s test suite includes src/test/no-network.test.ts, which reads every source file and fails if any of these patterns appears outside an allowlist:

const ALLOWED_FILES = ['src/domain/net/ecb.ts'];

const FORBIDDEN = [
  /\bfetch\s*\(/,
  /\b(?:globalThis|window|self)\s*\.\s*fetch\b/,
  /\bXMLHttpRequest\b/,
  /\bWebSocket\b/,
  /\bEventSource\b/,
  /navigator\s*\.\s*sendBeacon/,
  /\bimportScripts\s*\(/,
];

The allowlist has one file. The second pattern is there because the first wasn’t enough: globalThis.fetch(...) is a property access, not a plain call, and it slipped past both the linter rule and the original list.

The allowlist used to be longer. It included a file meant for fetching investment quotes, which nobody had written yet. The comment in the test explains why it was removed: a permission granted in advance to a file that doesn’t exist is the opposite of what the test is for. Whoever writes that file will see the test fail and have to add it by hand, which is exactly the conversation that should happen.

The same test file checks three more places a request could hide:

The linter applies the same restriction while you type: ESLint’s no-restricted-globals forbids fetch, and no-restricted-properties forbids fetch, XMLHttpRequest, WebSocket and EventSource on globalThis, window and self. Only ecb.ts has the rule turned off, in the config, so the legitimate call doesn’t need an eslint-disable comment that someone might later copy.

It’s a blunt tool on purpose: it doesn’t judge whether a new network call is “safe”, it makes adding one a visible, reviewed decision.

The one exception, and why it’s off

Ahorreo has exactly one kind of outbound request: fetching public tables from the ECB, the reference exchange rates and the Euribor series used to review variable-rate mortgages. It’s off by default (allowPublicRateFetch: false). With the setting disabled, no request is made. With it enabled, every fetch is triggered by a click, never by a timer running in the background.

We originally left Euribor as manual entry, and changed our minds once we saw the real cost: someone who has had a variable-rate mortgage for many years would have to type in every past review by hand, or live with a schedule projected at a 0% rate, a false number that looks precise.

The request itself carries as little as we could make it. From src/domain/net/ecb.ts, it sends no cookies (credentials: 'omit'), no referrer, and gives up after 15 seconds:

response = await fetch(url, {
  signal: controller.signal,
  credentials: 'omit',
  referrerPolicy: 'no-referrer',
});

What the ECB can still infer

No amounts, accounts or identifiers travel in that request: only the name of a public statistical series and a date range. But “nothing about you” would be too strong, and the comment at the top of ecb.ts spells out what the ECB’s servers see. An IP address asking for a public table. Which Euribor tenor you follow, which suggests you have a variable-rate mortgage. From which month you ask, which is probably close to when you signed it. And which currencies you convert, which are the ones that aren’t your own. None of that is your data travelling, but it isn’t nothing either, and that’s why the switch starts off.

Exchange rates also work without the switch. A snapshot of ECB reference rates is bundled into the build, with its date shown, and you can type rates in by hand. Consolidating several currencies offline is a requirement, not a fallback.

Layer 4: you can verify it

None of this asks for your trust. Three checks, from quickest to most thorough:

  1. Open your browser’s developer tools, switch to the network tab, and import a statement. You’ll see the app’s own files and nothing else.
  2. In the same tools, select the page request and look at the response headers. The Content-Security-Policy line should match the one above.
  3. In the console on the Ahorreo tab, run fetch('https://example.com'). The browser blocks it and reports a CSP violation, because example.com isn’t in connect-src. Any script on the page, including one that shouldn’t be there, gets the same answer.

Keeping data safe without a cloud

Without a server, the main risk isn’t a breach; it’s loss. Ahorreo handles that with files you own:

Less data, less risk

The final layer is the simplest: don’t keep what you don’t need. When Ahorreo reads a payslip PDF, it discards identity data (name, address, ID number, social security numbers) at the moment of parsing, and the original PDF is never stored. A test parses a synthetic payslip that contains all of those fields, serialises the result, and fails if any of them appears in it.

What this doesn’t protect against

The layers above are about Ahorreo’s own code. Some risks sit outside it, and it’s better to name them:

What Ahorreo does with the data it keeps is in Introducing Ahorreo, and how it categorises transactions without sending them anywhere is in Categorising bank transactions without a server.

This article explains how our software works and the maths behind it. It is not financial, tax or legal advice: for decisions about your own money, check with a qualified professional.