Skip to content

Security and privacy

This page is the one place that states what HealthLog protects, what it does not, and how you check the claims yourself instead of taking them on trust. Nothing here is a certification. A SOC 2 or HIPAA attestation certifies the operator of a hosted service, and on a self-hosted instance the operator is you, so buying one would say nothing about the software. What can be verified is the software: the image is signed, the build is attested, the ingredient list ships with it, and every claim below points at the file or the command that backs it.

Claim How you check it
Credentials, free text, documents, questionnaire answers and AI-written text are encrypted at rest with AES-256-GCM; measurement values, lab values, medication names and mood scores are not Encryption at rest, src/lib/crypto.ts
No usage telemetry, no third-party trackers What leaves the instance below, and the strict CSP in src/proxy.ts
The image was built by this repository’s release workflow cosign verify, below
The image contents are enumerable SBOM attestation, below
Vulnerabilities have a private reporting path SECURITY.md

Sensitive stored values are encrypted with AES-256-GCM, an authenticated mode, so a tampered or truncated ciphertext is rejected on decrypt rather than decoding into garbage. Each value gets a random 12-byte IV and is stored as iv ‖ tag ‖ ciphertext, base64-encoded, behind a key id:

<keyId>.<base64(iv ‖ tag ‖ ciphertext)>

The key id indexes into an ENCRYPTION_KEYS JSON map, which is what makes zero-downtime rotation possible. Several keys coexist, new writes use the active one, and a rotation (Admin > Encryption > Rotate now, or the script) re-wraps old rows on its own schedule while the app keeps serving. The operator procedure is Rotate the encryption key.

What is encrypted: every credential that would let an attacker pivot outward or impersonate you (provider tokens, bring-your-own AI keys, VAPID secrets, notification channel credentials, even the last integration error string, because upstream errors have a habit of echoing secrets back), free text you write, documents with their extracted text, questionnaire answers, AI-written text, the Coach conversation with the tables of values its answers read, the GPS tracks of your workouts, and the phone numbers and addresses of your practitioners. Measurement values, lab values, medication names and mood scores are not column-encrypted; they are the rows you query and chart constantly, and they sit on a database you already control, so protect its volume and backups like the host. The full list is on Encryption at rest.

The defining property is that every failure path throws. A missing key, malformed key JSON, an unknown key id, a legacy ciphertext with no v1 key configured: each raises rather than degrading to plaintext. The usual encryption-at-rest bug is a fallback that writes the value in the clear “just this once” and nobody notices for a year. A misconfigured key here takes the feature down loudly instead, which is the trade the project wants.

The practical corollary during a rotation: keep the old key in the map until Admin > Encryption reports zero remaining rows on it and no backup you may still restore needs it. Drop it early and those rows become undecryptable, and the app will tell you so rather than paper over it.

The software sends no usage telemetry. There is no analytics beacon, no crash reporting by default, no anonymous statistics, no fonts from a CDN, no tag manager, no embedded tracker. The strict Content-Security-Policy with a per-request nonce and a surgical connect-src makes that enforceable rather than promised, and there are no CORS headers anywhere outside the documented webhook routes, which authenticate by header secret rather than by cookie.

Most outbound traffic exists only because someone configured it: an AI provider, a device vendor, a notification channel, the push relay for the App Store iPhone app (sealed envelopes it cannot read, off until an admin turns it on), a document archive, an off-host backup bucket, or the error reporting, page analytics and log shipping an operator can point at services of their own. Privacy architecture walks each of those flows.

Three outbound calls happen without you configuring anything, and they are worth naming rather than rounding the claim up to “nothing leaves”.

Destination When What is sent How to stop it
api.pwnedpasswords.com A password is set, changed, or admin-reset The first five hex characters of the SHA-1 of the candidate password, and nothing else. The remaining 35 characters are matched locally against the response, so neither the password nor its full hash crosses the network. The request carries Add-Padding: true so the response size does not leak which bucket was queried. PASSWORD_BREACH_CHECK_DISABLED=1, or block the host at the network level. Either way the check fails open: setting a password still works, and a known-breached password is no longer refused.
ipwho.is A sign-in is geo-resolved for the login-history surface, and only for an address the offline GeoLite2 databases could not place The IP address of the person signing in Mount the GeoLite2 databases: the resolver reads them first, and an address they place never goes online. IP_GEO_LOOKUP_DISABLED=1 turns the online lookup off entirely; IP_GEO_LOOKUP_URL moves it to a different provider rather than stopping it. See the note below.
api.github.com When a signed-in user opens the About page (at most once a day per browser, remembered in the browser), and on each fresh load of the admin overview. The cadence is a client cache, not a server-enforced bound Nothing about the instance beyond the request itself. The route reads the latest release tag and compares it locally. UPDATE_CHECK_DISABLED=1: the route answers unknown with reason disabled and contacts nobody, and the admin version card says Update check off. Blocking the host also works.

None of the three carries health data. The first two carry something worth knowing about: a password prefix, and a login IP. Both are documented above rather than filed under “outbound connections only to services you configured”, because that sentence would be tidier than the truth.

Every outbound call from server code goes through a single safeFetch wrapper with manual redirect handling and a request timeout, and an in-repo lint rule rejects a bare fetch( in server code outside that wrapper, so a new egress path cannot skip the guard by being written in a hurry. For an operator- or user-supplied host it can also pin a connect-time public-address check, which is what closes SSRF via DNS rebinding and via redirect.

Three layers a request passes through: an auth perimeter (passkey first, Argon2id password fallback), a session perimeter (HttpOnly SameSite cookie, Postgres-backed sessions, requireAuth and requireAdmin), and the encrypted core (AES-256-GCM under versioned keys, Bearer tokens stored as HMAC digests). Side rails: rate limiter, audit log, CSP and HSTS, SSRF guard, API tokens, refresh tokens, off-host backup, per-user scope.

Self-hosting changes who holds the data. It does not make the data unreachable, and the honest version of that is short.

What self-hosting plus encryption at rest gets you. There is no vendor account and no key escrow, so no third party can be served process for data it does not have. A stolen disk or a leaked backup does not yield the encrypted fields as long as the key is held separately from the image of the disk. No health data reaches an analytics or advertising endpoint, because no such endpoint is contacted at all.

What it does not get you. If the running machine is seized, imaged, or compelled, the data is on it, and encryption at rest does nothing for a live host whose key is loaded. A hosting provider can snapshot a VPS disk and can be served process, so renting infrastructure narrows the set of parties who hold your data without emptying it. The nightly database dumps, the off-host copies and any dump you take yourself carry the same data and belong to the same surface; a local dump is encrypted only in the fields HealthLog encrypts, like the database beside it. A phone or laptop with a live session holds data locally, and no server-side control reaches it. And on the instance itself, an administrator can read the database directly, which is why what a shared record is treats “who can read it on that hardware” as a separate question from “what leaves the host”.

What a bug inside the container can reach. Since v1.47.0 the app and the worker connect to Postgres as a role of their own that reads and writes rows but cannot change or drop tables, create functions, read server files or create roles; the migrations and restores run as the database owner. That needs Postgres 17 or later and a database user that may create roles, which the bundled compose file provides; elsewhere the start log says why it is not in place. The image carries no package manager (npm, npx, corepack and yarn are removed). Code that a compromised dependency ran inside the app would find a connection that can reach the rows, not one that can rewrite the schema.

A worked example of the same reasoning applied to the most sensitive category in the app is the cycle-data threat model.

Every release image is signed keyless through Sigstore in the release workflow. GitHub’s OIDC token is exchanged for a short-lived Fulcio certificate bound to the workflow identity, the signature is recorded in the Rekor transparency log, and no long-lived signing key exists anywhere in the pipeline to leak or rotate. What is signed is the multi-arch manifest index, so one signature covers both the amd64 and the arm64 manifest.

Install cosign, then:

Terminal window
cosign verify \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp 'https://github.com/MBombeck/HealthLog/\.github/workflows/docker-publish\.yml@refs/tags/v.*' \
ghcr.io/mbombeck/healthlog:v1.37.0

A pass prints the checks that were performed and the signed payload:

Verification for ghcr.io/mbombeck/healthlog:v1.37.0 --
The following checks were performed on each of these signatures:
- The cosign claims were validated
- Existence of the claims in the transparency log was verified offline
- The code-signing certificate was verified using trusted certificate authority certificates

That proves the image was built by this repository’s release workflow on a v* tag. It does not prove the tag still points where it did an hour ago, because a tag is a mutable alias. The digest is the image’s only immutable identity, and the digest is what the signature actually covers, so for any deploy where supply-chain integrity matters more than convenience, verify and pin the digest:

Terminal window
cosign verify \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp 'https://github.com/MBombeck/HealthLog/\.github/workflows/docker-publish\.yml@refs/tags/v.*' \
ghcr.io/mbombeck/healthlog@sha256:4adabd76f105e60338ab567e97014d543ebe301e73f9b5482ae1356acf9c6b3f

The compose file carries the hook for pinning: set HEALTHLOG_IMAGE_REF to @sha256:<digest> in your .env and the app service follows it. Pinning is sticky, though, and a stale pin is silent, so bumping it becomes part of shipping. Updates and deploy has the full note.

Each release image carries a SLSA build-provenance attestation produced by BuildKit and pushed alongside the manifest. Read it with the Docker CLI:

Terminal window
docker buildx imagetools inspect ghcr.io/mbombeck/healthlog:v1.37.0 \
--format '{{ json .Provenance }}'

The statement names the build type, the Dockerfile it was built from, the build arguments (including the commit SHA and the build timestamp that /api/version reports back at runtime), and the source repository:

"externalParameters": {
"configSource": { "path": "Dockerfile" },
"request": {
"args": {
"build-arg:NEXT_PUBLIC_APP_VERSION": "v1.37.0",
"label:org.opencontainers.image.revision": "381a07a13486913412d05d0d28d344587310fed1",
"label:org.opencontainers.image.source": "https://github.com/MBombeck/HealthLog"
}
}
}

One thing to know before you reach for it: gh attestation verify will not find these. That command reads GitHub’s attestation API, which is populated by the actions/attest-build-provenance action, and this pipeline attaches BuildKit’s own attestation to the image in the registry instead. The provenance is real and readable with the command above; it just does not live where the gh CLI looks.

Each image also carries an SPDX Software Bill of Materials, generated at build time, listing the packages and files that went into it:

Terminal window
docker buildx imagetools inspect ghcr.io/mbombeck/healthlog:v1.37.0 \
--format '{{ json .SBOM }}'

The document identifies its own generator, which is worth checking when you feed it into a scanner:

"creators": [
"Organization: Anchore, Inc",
"Tool: syft-v1.42.3",
"Tool: buildkit-v0.31.2"
]

Pipe it into whatever you already run. The output is per-platform, keyed linux/amd64 and linux/arm64, so pick the key that matches the host you are deploying to.

The release pipeline is not the only gate. Every push and every pull request runs lint, a strict TypeScript pass, the unit suite, a Prettier check, and an OpenAPI drift check that fails when the published contract stops matching the schemas it is generated from. In the same run, a dependency audit fails the build on a high or critical advisory against a production dependency, and Gitleaks scans the full history for secret-shaped strings. On a push to the default branch the image is built and scanned with Trivy as well, and a high or critical finding fails the job rather than filing a warning nobody reads. The release itself will not publish unless the commit is an ancestor of the default branch, the tag is strict SemVer, the tag matches the version in package.json, and that same commit already has a green quality run behind it.

Do not open a public issue for a vulnerability. Mail [email protected] with a description, reproduction steps, the impact you see, and a suggested fix if you have one. Acknowledgement inside 72 hours, initial assessment inside a week, and disclosure coordinated with you. The full policy, including what is in and out of scope, is in SECURITY.md.