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:
index.htmlmay contain absolute URLs only in metadata (canonical link, Open Graph, structured data) and plain links. No<script src>, stylesheet or image from elsewhere, and only one script: the app’s own.- No source file may contain an absolute URL outside comments, apart from the SVG namespace.
- The service worker, which sees every request the app makes, may contain no absolute URL, may only
fetchthe request it received, and must ignore anything not from its own origin.
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:
- 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.
- In the same tools, select the page request and look at the response headers. The
Content-Security-Policyline should match the one above. - In the console on the Ahorreo tab, run
fetch('https://example.com'). The browser blocks it and reports a CSP violation, becauseexample.comisn’t inconnect-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:
- Encrypted backups. A
.ahorreofile encrypted with AES-256-GCM, using a key derived from your password with PBKDF2-SHA256 and 600,000 iterations, all through the browser’s WebCrypto API (src/domain/backup/crypto.ts). GCM also authenticates the file: if a single byte is altered, the whole backup is rejected rather than partly restored. The password can’t be recovered, and the app says so before you create the first backup. - A guard on hostile files. The iteration count is read from the file, and a file claiming 500 million iterations would freeze the tab. Anything above 10,000,000 is rejected with an explanation.
- A live file on disk. On browsers that support the File System Access API, Ahorreo can save continuously to a file you choose. Put that file in a folder you already sync, and it reaches your other devices without the app making a single request.
- Lineage instead of silent overwrites. The file’s header, which isn’t encrypted, records which device last wrote it and the state it carries. Before asking for the password, Ahorreo compares it with what you have and tells you one of four things: you already have this state, this backup is behind, this backup is newer than your data, or it can’t place the file because it predates the format.
- A reminder, seven days or 50 new transactions after your last backup, whichever comes first.
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:
- The host. The CSP is sent by the same server that sends the JavaScript. If the hosting were compromised, both could be changed together. The tests protect the source; they can’t protect a server we don’t control from being tampered with.
- Browser extensions. An extension with access to all sites can read the page, and the CSP doesn’t apply to it. If you use extensions you don’t fully trust, a separate browser profile for Ahorreo is a reasonable precaution.
- Your device. Data in IndexedDB is as safe as the account on the computer it lives in. Anyone who can open your browser profile can open Ahorreo.
- Your backups. An encrypted backup is only as strong as its password.
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.