Author SHA1 Message Date
BobbyandClaude Opus 5.5 7010e07cb0 Research: Linode Managed PostgreSQL networking, security, backups (#49)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:09:08 -05:00
13 changed files with 105 additions and 462 deletions

No files matched your search

-2
View File
@@ -1,2 +0,0 @@
.claude/
-67
View File
@@ -1,67 +0,0 @@
# hAPI
hAPI ("home API") is a personal, cloud-hosted API serving one household and its automations: finance, fitness, home maintenance, and smart home. Access is restricted to a small, known set of Principals.
## Language
### Access
**Principal**:
Anything that authenticates to hAPI.
_Avoid_: User, account, client
**Person**:
A human Principal (the Owner, family, friends).
_Avoid_: User, human user, member
**Bot**:
A non-human Principal: a script, automation, or integration such as Home Assistant.
_Avoid_: Service account, machine user, integration account
**Owner**:
The single Person with administrative authority over hAPI and every other Principal. That authority covers Principals and the platform, not other Persons' Personal data.
_Avoid_: Admin, root, superuser
**Token**:
A Principal's secret credential for the API.
_Avoid_: API key, password
**Scope**:
A domain paired with read or write access: the unit of access that Household grants and Bindings carry.
_Avoid_: Permission, privilege
**Binding**:
A Person's consent letting a specific Bot act on that Person's Personal data in one domain, up to a given Scope.
_Avoid_: Delegation, impersonation, link
**Household grant**:
The Owner's permission for a specific Bot to act on one domain's Household data, up to a given Scope.
_Avoid_: Permission, role
### Ownership
**Household**:
The single group of Persons that hAPI serves. There is exactly one.
_Avoid_: Family, tenant, organization, group
**Household member**:
A Person who belongs to the Household. A Person can be a Principal without being a Household member (e.g. a friend).
_Avoid_: Family member, resident
**Personal data**:
A record owned by one Person, visible only to that Person (and to Bots bound to them).
_Avoid_: Private data, user data
**Household data**:
A record owned by the Household, visible to every Household member.
_Avoid_: Shared data, common data
**Recorded by**:
The Principal that created or last changed a record, distinct from who owns it.
_Avoid_: Author, owner, creator
### Smart home
**Job**:
A request, queued in hAPI, for Home Assistant to carry out an action in the house. Jobs are Household data. Domain code, Persons, and Bots can all create them.
_Avoid_: Task, command, message
-12
View File
@@ -1,12 +0,0 @@
# Every record is owned by a Person or by the Household
hAPI serves exactly one Household, so there is no multi-tenancy. Every record is either **Personal data**, owned by one Person and visible only to them, or **Household data**, owned by the Household and visible to every Household member on equal terms. Each record type declares which kind it is: fitness is personal, home maintenance and smart home are household, and finance has both. We chose this over per-record sharing (which needs sharing lists and revocation) and over "everything household" (which gives no privacy for personal finances). Anything that needs to be shared is modelled as Household data.
## Consequences
- **The Owner has no special read access to Personal data.** Owner authority covers Principals and the platform only. Bots reach Personal data only through a **Binding** that the bound Person grants and can revoke. The Owner cannot grant one on another Person's behalf.
- Every record carries its owner plus **Recorded by**: the Principal that created it and the one that last changed it. Principals are deactivated, never hard-deleted, so Recorded by never dangles.
- Ownership is fixed when a record is created, except that a Person may move their own Personal record to the Household (one way only).
- When a Person is removed, their Personal data is exported and then explicitly deleted. Household data they recorded stays with the Household.
- Persons who are not Household members (e.g. friends) see only their own Personal data.
- Not in v1: roles within the Household, sharing outside the Household, and guest access to Household data.
-18
View File
@@ -1,18 +0,0 @@
# One public surface, gated only by hAPI's own auth; no tunnel to home
Persons must reach hAPI from anywhere without a VPN. The home network sits behind ISP CGNAT with a changing IP, so the cluster can never open a connection into the home, and the home IP can't be allowlisted. A CGNAT address is shared with other customers, so allowlisting it would also let them in. We therefore expose **one public surface**, the hAPI API over HTTPS on `:443`, used by Persons and Bots alike, with **hAPI's own authentication as the only gate**. Bots get no separate network path: no VPN, no separate port, no client certificates. Writing a cron job then takes nothing more than `curl` with a token. We chose this over a tunnel for Bots (Tailscale or WireGuard, with a client on every Bot) and over a client-cert-gated Bot port. Both were workable but added setup to every Bot. Client certs stay available as later hardening.
## Considered Options
- **A tunnel for every Bot (Tailscale + k8s operator, or plain WireGuard).** Works behind CGNAT because home dials out. Rejected: every Bot needs a client, and the Tailscale operator can't be used with Tailnet Lock, which leaves Tailscale's control plane trusted.
- **Client-cert-gated Bot endpoints.** Gateway API enforces client certs per port, not per hostname, so this needs its own port. Home Assistant can present a client cert only over MQTT. Rejected as v1 friction.
- **An identity-aware proxy or CDN in front (e.g. Cloudflare).** Rejected: we want no third party in the public request path, meaning no browser challenge pages and no outage when a vendor has one.
## Consequences
- **Traffic between the cluster and home only ever starts from home.** hAPI never calls into the house. The job bridge to Home Assistant must be one that HA connects out to (pulls or holds open).
- **Every public endpoint is TLS-only and requires per-Principal auth.** No anonymous endpoints, including health: Uptime Kuma is a Bot with a health-only scope. `:80` is closed, so certificates use ACME DNS-01. A broker, if the bridge needs one, may be public under the same rule.
- **Bot credentials carry the security a network gate would have.** Each is per-Bot, scoped, individually revocable, and stored hashed. A long-lived JWT that can't be revoked is not acceptable as a Bot credential.
- **Owner administration has no HTTP route.** Creating Principals, issuing and revoking credentials, and Household grants are done through an admin CLI inside the hAPI pod, reached only through cluster management access. Persons' own actions, including granting Bindings, stay on the public API.
- **Cluster and node management APIs (Kubernetes, Talos) are never public.** They're reachable only over a management-only Tailscale tailnet (node extension plus the Owner's devices) with Tailnet Lock on. This tailnet is not in the public request path, so a Tailscale outage never takes hAPI down. Break-glass: the Linode LISH console, or a temporary firewall rule for the Owner's current IP.
- **Never public:** the database, metrics, detailed health, and any internal service.
@@ -1,18 +0,0 @@
# Talos on Linode with one control-plane node, Cilium, and OpenTofu
The hAPI cluster runs **Talos Linux** on Linode compute in `us-iad`: **one control-plane node and two workers**, all `g6-standard-2`, provisioned with **OpenTofu**. Its CNI is **Cilium**, with WireGuard encrypting traffic between nodes. We chose Talos because it is immutable and managed only through an authenticated API, with no shell or SSH. That fits a security-first, one-operator cluster better than RKE2 (CIS-hardened, but a general-purpose OS to patch), k3s (defaults favor convenience) or kubeadm (most learning, weakest defaults). A single control-plane node keeps cost and moving parts proportionate to a small load. Postgres is a managed service outside the cluster, so etcd holds no hAPI data, and the cluster can be rebuilt from code.
## Considered Options
- **Three control-plane nodes (HA etcd).** Rejected for v1 as oversized. With dedicated workers it costs about $48/mo more. Running workloads on the control plane instead would mix them with etcd. Moving to three is an additive Talos change.
- **A NodeBalancer in front of the Kubernetes and Talos APIs**, as the Talos Linode guide describes. Rejected: ADR-0002 keeps those APIs off the internet. The cluster endpoint is the control-plane node's tailnet name instead.
- **VPC-only nodes behind a NAT gateway.** Rejected for now: Tailscale would fall back to DERP relays, and the NAT gateway is newer. Nodes have public IPv4 with a firewall that denies all inbound traffic except Tailscale's UDP port.
- **Terraform.** OpenTofu is chosen for its open licence and its client-side state encryption. The state holds Talos machine secrets.
## Consequences
- **Losing the control-plane node means rebuilding it from code.** Workloads keep serving in the meantime, but the cluster can't be changed until it is back.
- **No SSH, ever.** All node access goes through `talosctl` over the management tailnet. Break-glass is the Linode LISH console.
- **Every node joins the management tailnet** with a pre-signed auth key, so Tailnet Lock stays on.
- **OpenTofu and Talos install only Cilium and the Linode CCM.** These are what nodes need to become Ready. Everything else arrives through delivery.
- **Disks are encrypted at rest** with Talos LUKS on STATE and EPHEMERAL, in addition to Talos's default encryption of Secrets in etcd.
-33
View File
@@ -1,33 +0,0 @@
# Database access: VPC-only, two roles, Personal data isolated by row-level security
hAPI uses a **Linode Managed PostgreSQL 18** cluster (Shared 2 GB, 1 node) attached to the cluster's VPC with `public_access = false`, and its allowlist holds only the VPC subnet. Clients connect with `sslmode=verify-full` and scram-sha-256 passwords. Two roles share the `hapi` database. **`hapi_migrator`** owns every schema and table and runs `hapi migrate`. **`hapi_app`** has DML only; the running app and the admin CLI both connect as it. Personal-data tables have `ENABLE ROW LEVEL SECURITY` (not `FORCE`), with policies keyed on a per-transaction `SET LOCAL hapi.principal_id`, so a forgotten `WHERE` in a handler returns nothing instead of leaking another Person's data. `hapi_app` never owns a table and has no `BYPASSRLS`. That keeps ADR-0001's rule (not even the Owner reads others' Personal data) in the database for everything the app does. We accept that VPC for Managed Databases is still labelled beta, because ADR-0002 rules out a public database endpoint. It was verified working in `us-iad`.
**Amended by ADR-0005:** RLS also covers **Household data** tables. Their policies allow an active Household member or a Bot with a Household grant for that domain. Personal-data policies also allow a Bot that holds an active Binding from the record's owner. In both cases `USING` checks the read Scope and `WITH CHECK` checks the write Scope. `hapi.principal_id` is always the authenticated Principal, Person or Bot. The CI isolation check below covers every owned table, Personal or Household.
## Considered Options
- **Public endpoint with a node-IP allowlist.** Rejected: it contradicts ADR-0002 ("Never public: the database").
- **App-only filtering (no RLS).** Rejected: one missed filter becomes a data leak. Wrong-Principal tests stay mandatory on top of RLS.
- **`FORCE ROW LEVEL SECURITY`.** Rejected: it binds the owner `hapi_migrator` too, so every data migration and break-glass session would need `ALTER TABLE … NO FORCE`. The only thing it adds is protection against the migrator, which is the operator, and the operator is outside RLS's guarantee anyway.
- **Signed principal context, or one role per Person.** Rejected as protection against leaked `hapi_app` credentials. A signing key would live in the same pod as the password. Per-Person roles would all have to be grantable to `hapi_app`, so leaked credentials could switch to any of them.
- **A single role, or one role per domain schema.** One role lets the app run DDL and own tables, and owners bypass RLS. Per-domain roles add no isolation, because the monolith process would hold all of them anyway.
- **A `BYPASSRLS` role for admin tooling.** Rejected: the Owner has no read access to Personal data, so nothing in the request path or admin CLI needs one.
- **Managed or self-hosted PgBouncer.** Not needed at this load (see the connection budget below).
- **PostgreSQL 19.** Newly offered on the platform. We stay on 18, which all our verification ran on and which nothing in v1 outgrows. Revisit at the first major-upgrade window.
## Consequences
- **What RLS protects against:** app bugs only. Anyone holding `hapi_app` credentials can set any `hapi.principal_id`. Leaked credentials are contained by the network, because the VPC-only allowlist (verified as the enforcing control) limits use to the cluster and VPC. Whoever holds `akmadmin` (which has `BYPASSRLS`), `hapi_migrator` or the OpenTofu state can read everything. Owner non-access is enforced by policy and audit, not cryptography. Per-Person encryption is out of scope for v1.
- **Policies treat an unset principal as no principal.** After a transaction, the setting reads `''`, not NULL, so policies use `nullif(current_setting('hapi.principal_id', true), '')`.
- **CI enforces isolation:** every owner-mixin table must have `relrowsecurity` set and be owned by `hapi_migrator`, never `hapi_app`. Tests and local dev use the same bootstrap and connect as `hapi_app`.
- **`akmadmin` is never in the cluster.** An idempotent `hapi db bootstrap` admin CLI command creates the roles and the database. The Owner runs it in a pod and pastes in the `akmadmin` password at run time. It does the following:
1. Waits until the private hostname resolves (about 60 s after the cluster reports ready).
2. Creates `hapi_migrator` and `hapi_app`.
3. Runs `CREATE DATABASE hapi OWNER hapi_migrator`.
4. Runs `SET ROLE hapi_migrator` for the database-level `REVOKE`/`GRANT`s and `ALTER DEFAULT PRIVILEGES`. Run as `akmadmin`, these silently do nothing.
- **Cross-Person work runs per Person.** Purging a removed Person's data, or a job such as reminders, sets `hapi.principal_id` to each Person in turn.
- **Data repairs** normally ship as reviewed Alembic data migrations run as `hapi_migrator`, targeting rows by id or condition without printing them.
- **Break-glass goes through `hapi db breakglass --reason "…"`.** It opens `psql` as `hapi_migrator` from a pod and emits structured audit events to hAPI's centralized logs: start, end, reason, and every statement. Query results are never logged. The platform offers no statement logging or pgaudit, so this is the only audit trail.
- **Connection budget:** the plan allows 50 connections. That leaves about 46 usable after 3 reserved superuser slots and one platform backend. Each app pod holds at most 10 (`pool_size=5`, `max_overflow=5`), and the admin CLI holds 1–2. The rule is: (maximum concurrent app pods, including rollout surge) × 10, plus about 6 for migrate, CLI, break-glass and bootstrap, must be ≤ 46. That caps app pods at 4. Any future worker process counts against the same budget.
- **Plan changes are restores.** An in-place resize stalled during verification. Changing size or node count is done as a restore-to-new-cluster, with the same runbook as disaster recovery: fork, wait for DNS, `hapi db bootstrap`, repoint the app. Single-node maintenance windows (pinned to a quiet slot) cause short downtime, covered by 14-day point-in-time recovery.
- Passwords are rotated manually with a runbook. `password_encryption` is set explicitly to `scram-sha-256`.
@@ -1,26 +0,0 @@
# Opaque per-Principal tokens; authorization by ownership, grants and row-level security
In v1, every Principal (Person or Bot) authenticates with a bearer **Token**. There is no identity provider and no interactive login, because there's no frontend: Persons use scripts, HTTP clients and Shortcuts, just as Bots do. A Token is opaque: `hapi_<public-id>_<secret>`, where the secret has 256 bits of entropy. hAPI stores only a SHA-256 of the secret and looks the Token up in Postgres on every request, so revoking a Token takes effect immediately, as ADR-0002 requires. Authorization keys off the **Principal**, never the credential. Persons are authorized purely by ownership (ADR-0001). Bots have no access until they're given a **Scope** (`<domain>:read` or `<domain>:write`, where write implies read, plus the special `health` scope). A Bot gets Scopes through **Household grants**, which the Owner gives through the admin CLI, and **Bindings**, which a Person gives through the API, one domain at a time. Enforcement sits in row-level security as well as in the app, so a forgotten check fails closed.
## Considered Options
- **OIDC with a self-hosted IdP** (Authelia, Kanidm, Pocket ID). Rejected for v1. It's another public-facing service to run and secure, every request would depend on it, and refresh flows are painful for curl cron jobs.
- **Passkeys served by hAPI.** These need a web origin and a login page, which amounts to a frontend. Deferred until a frontend exists (see Consequences).
- **Short-lived JWTs signed by hAPI, plus refresh tokens.** Rejected. Revocation lags by up to a token lifetime, there's a signing key to manage, and every client needs refresh logic. At our load, one indexed lookup per request costs nothing, and it uses the request's own pooled connection.
- **mTLS client certificates.** Already rejected in ADR-0002.
- **Per-resource or per-record-type Scopes** (e.g. `finance.transactions:write`). Rejected as premature. A domain Scope can later be split into finer ones without breaking anything.
- **Choosing whose Personal data a Bot means with a request header** (`Hapi-Acting-For`). Rejected because the same URI would then name different resources depending on the header.
- **Nested owner paths** (`/persons/{id}/workouts`, `/household/transactions`). Rejected. ADR-0001 lets a record move from Personal to Household, and nesting would change its URI when it does. Listing everything a Bot may see would also take one call per Person.
- **Owner powers on the public API** (e.g. revoking a Bot from a phone). Rejected. If the Owner's Token leaks, it should do no more harm than any other Person's.
## Consequences
- **Resources are flat and ownership is an attribute.** Each record has exactly one URI, `/v1/<domain>/<things>/{id}`, and keeps it when it moves to the Household. Every record exposes `owner` (a Person id or `household`) and `recorded_by`. Lists accept `?owner=me|household|<person-id>`, and without a filter they return everything the caller may see. When creating a record, `owner` is required for a Bot writing Personal data. For a Person it defaults to themselves on Personal types and to the Household on Household types.
- **`hapi.principal_id` is always the authenticated Principal.** Personal-data policies allow rows where the owner is the principal, **or** the owner has an active Binding to the principal for that domain. Household-data policies (amending ADR-0004) allow an active Household member **or** a Bot with a Household grant for that domain. `USING` checks the read Scope and `WITH CHECK` checks the write Scope. Routes also declare `require_scope(...)`, so a caller missing a Scope gets a clean `403` and the Scope appears in the OpenAPI export. Recorded by is simply the principal.
- **Responses:** any missing, malformed, unknown, expired or revoked Token gets the same `401` with `WWW-Authenticate: Bearer`. A missing Scope or Binding returns `403`. A record the caller can't see returns `404`. Tests cover wrong Person, wrong Bot, a revoked Binding and a read-only Scope attempting a write.
- **Token lifecycle:** Tokens expire after 365 days by default, with the lifetime configurable when issued. `--no-expiry` is allowed only for Bots, and the CLI lists such Tokens in a warning. A Principal may hold several live Tokens, so rotation goes issue, swap, revoke. `last_used_at` is written at most about once an hour, and `hapi token list` flags Tokens that are near expiry or unused for 90 days.
- **Issuing stays in the CLI** (ADR-0002). On the public API, a Person may list and revoke their own Tokens (but not mint them), grant, list, change and revoke their Bindings, and list Bots (id, name, description). The Owner cannot create a Binding on a Person's behalf.
- **Deactivation** revokes all of a Principal's Tokens and makes its Household grants and Bindings inert, whichever side of a Binding it was on. Household membership is a flag the Owner sets in the CLI. The Owner can't be deactivated; ownership is transferred through a CLI command that needs the current Owner's confirmation.
- **Auth is audited in the logs.** Every auth decision is logged as a structured event with the principal id, the credential's public id, the outcome and the reason. Changes to Tokens, grants and Bindings are logged as audit events. Secrets are never logged. There's no app-level rate limiting, since 256-bit secrets can't be brute-forced. Any per-IP limits belong at the Gateway.
- **The Token prefix is deliberate.** It lets secret scanners and push protection recognise a leaked Token.
- **A future frontend adds a credential kind and changes nothing else.** Credentials carry a `kind`, which is `api_token` in v1. A browser login (passkeys or OIDC) would add, say, a `session` kind that resolves to the same Person. Scopes, Bindings and RLS stay as they are. Cookie, CSRF and CORS handling arrive with that frontend.
@@ -1,20 +0,0 @@
# Home Assistant polls hAPI for Jobs that name allowlisted HA scripts
hAPI needs Home Assistant to carry out actions in the house: things queued while a Person is away, or one-offs not worth configuring in HA. Traffic between the cluster and home only ever starts from home (ADR-0002), so HA has to come to hAPI. A **Job** is Household data (ADR-0001), created by domain code, Persons, or Bots through `/v1/smart_home/jobs`. **HA polls** `GET /v1/smart_home/jobs/next` every 15–30 s with its built-in `rest` sensor. An HA automation runs the Job and reports back through `rest_command` to `POST /v1/smart_home/jobs/{id}/result`. A Job never names an arbitrary HA action. It names an **HA script** (`hapi_*`) plus variables, and HA only runs `script.hapi_*`, so HA decides what hAPI can ever trigger. Jobs tolerate about 30 s of latency: anything interactive and real-time goes from the Person straight to HA's own app, not through hAPI. This bridge carries only Jobs and their results. HA sends other data to ordinary domain endpoints as a Bot.
## Considered Options
- **MQTT through a Mosquitto broker in the cluster.** HA's supported message bus gives sub-second delivery. Rejected for v1: it means running and exposing a broker, plus an auth bridge so the broker understands hAPI Tokens, plus a single publisher process inside hAPI. HA's client always uses a clean session, so durability would live in hAPI regardless. MQTT remains the upgrade path if real-time Jobs ever matter.
- **RabbitMQ / AMQP.** HA has no AMQP integration and explicitly doesn't support RabbitMQ's MQTT plugin.
- **A custom HA integration** (long-poll or SSE against hAPI). This has the cleanest semantics, but it's Python to keep working through every HA release. Since 2026.11 it also can't be installed through the Marketplace from a private Gitea repo.
- **hAPI calling HA's REST or WebSocket API.** Ruled out by ADR-0002, because traffic only starts from home.
- **Jobs naming arbitrary HA actions** (e.g. `lock.unlock`). Rejected: any holder of `smart_home:write` could do anything HA can do.
## Consequences
- **The bridge needs no new infrastructure or credentials.** HA is the `home-assistant` Bot with a Household grant of `smart_home:write`, and its Token lives in HA's `secrets.yaml`. There's no `jobs` Scope: `smart_home:write` both creates Jobs and consumes them, and ADR-0005 allows splitting the Scope later.
- **Delivery is at-least-once, FIFO by `not_before` (or creation time).** `next` hands out the oldest eligible Job and hides it for a 2-minute lease. After 3 deliveries with no result, the Job becomes `failed` (`no_result`), so one broken Job can't stall the queue. HA scripts must be idempotent: set states, don't toggle. After each result, HA calls `homeassistant.update_entity` on the sensor so a backlog drains without waiting for the next poll.
- **Job lifecycle:** `pending → succeeded | failed | expired | cancelled`. A Job may carry an optional `not_before`. `expires_at` defaults to 1 h after `not_before` (or after creation), and an expired Job is never delivered. A result is `{status, error?, response?}`, where `response` holds the script's response variables. The first result wins, and a later one gets `409`. Any Household member, or any Bot with `smart_home:write`, can cancel a `pending` Job. Finished Jobs are immutable and are kept for 90 days. Until scheduling exists, `hapi jobs purge` removes them.
- **hAPI checks only the shape of a Job, not what it does.** Script names must match `hapi_[a-z0-9_]+`, and variables are capped at 16 KB. hAPI keeps no catalogue of HA scripts. HA rejects unknown scripts, which comes back as a failed result.
- **HA-side configuration** is a reference package in this repo (`integrations/home-assistant/hapi_jobs.yaml`: rest sensor, automation, rest_command), copied into HA by hand. The `hapi_*` scripts themselves live in a separate HA configuration repo.
- **hAPI records HA's last poll**, so a stalled bridge can be detected. Turning that into an alert is part of observability.
-24
View File
@@ -1,24 +0,0 @@
# Flux pulls from git; CI builds images and commits their digest
Every green merge to protected `main` reaches production, with no release tags and no staging. **Gitea Actions** runs CI on a dedicated runner VM. On a PR it runs lint, pyright, import-linter, the testcontainers test suite, the image build, a smoke test, the OpenAPI export, and a Trivy scan that fails on fixable critical or high CVEs. On `main` it also pushes the image to **Gitea's container registry** and commits the new **digest** into `deploy/apps/hapi`. **Flux** in the cluster polls this repo every minute and applies what's committed. The cluster pulls; CI never pushes to it. CI holds no cluster credentials, and the cluster holds no git credentials (the repo is public, so Flux fetches anonymously over HTTPS). Kubernetes and Talos APIs stay reachable only from the management tailnet (ADR-0002), and no CI system ever joins it.
## Considered Options
- **CI push** (`kubectl apply` / `helm upgrade` from a workflow). Rejected: the runner would join the management tailnet with a kubeconfig, so a compromised workflow or dependency would become cluster-admin, and Tailnet Lock would have to trust another node.
- **Argo CD.** Rejected for its web UI, which would need keeping off the internet, and its weight. One operator with `flux`/`kubectl` over the tailnet doesn't need a UI.
- **Flux image automation** writing digest bumps back to git. Rejected: it needs a write deploy key inside the cluster, turning a cluster compromise into a source-code compromise. CI already decides which image runs, so giving CI the write key adds little.
- **A Flux webhook `Receiver`** for instant deploys. Rejected: it's a new public HTTP route without per-Principal auth (ADR-0002). A one-minute poll is fine.
- **A runner on the Gitea host or in the cluster.** Rejected: a job with Docker access on the Gitea host can read every repo and every Actions secret, and the cluster shouldn't run CI workloads.
## Consequences
- **Layout:** `deploy/clusters/prod` (Flux's entry point), `deploy/infrastructure` (`HelmRelease`s for upstream components), `deploy/apps/hapi` (the Kustomize base, including the migrate Job). Flux runs with `prune: true` and drift correction on. The Owner installs Flux once over the tailnet with `flux install` plus a `GitRepository`/`Kustomization`. From then on Flux manages itself from git.
- **Migrations run as a Job in their own Flux Kustomization** (`hapi-migrate`), using `hapi_migrator` credentials (ADR-0004). The Job name carries the image digest, so each release gets a new Job. The app Kustomization `dependsOn` it with `wait: true`, so a failed migration stops the rollout and the old pods keep serving. **Migrations must be backward-compatible** (expand, then contract in a later release) because old pods run against the new schema. **Migrations go forward only:** there are no down-migrations.
- **Rollout:** 2 replicas, `maxSurge: 1`, `maxUnavailable: 0`, no HPA, a PodDisruptionBudget with `minAvailable: 1`, and replicas spread across the two workers. That's at most 3 app pods, within ADR-0004's cap of 4.
- **Rollback is `git revert` of the digest bump.** A rollout that never becomes ready stalls, and the old pods keep serving. There's no automated rollback. Break-glass: `flux suspend`, then `kubectl rollout undo`, then bring git back in line.
- **Images are public**, because Gitea package visibility follows the owner. Images must never contain secrets. Deploys reference digests, never mutable tags. Builds are amd64 only.
- **The CI write credential is a deploy key with write access**, stored as an Actions secret and allowlisted past `main`'s branch protection. The build workflow's path filter skips bump commits, so a bump doesn't trigger another build.
- **Renovate runs nightly** on the same runner as its own bot user. It auto-merges only dev-only tooling. Anything that ships (runtime dependencies, base image, charts, Flux, Talos, OpenTofu providers) arrives as a PR the Owner merges.
- **Not delivered through Flux:** the runner VM, Cilium, and the Linode CCM live in OpenTofu under `infra/`, and the Owner runs `tofu apply` over the tailnet. Talos and Kubernetes upgrades are a manual `talosctl` runbook. CI never holds the Tofu state key.
- **Failures notify through ntfy:** a final `if: failure()` step in each workflow, and Flux's notification-controller for failed reconciles and rollouts. Topics and auth are designed with notifications.
- **Deferred:** having Flux verify commit signatures, and signing images (cosign) with admission-time verification. Both guard against a compromised Gitea and belong together in cluster hardening.
-33
View File
@@ -1,33 +0,0 @@
# Secrets are SOPS-encrypted in the public repo; Owner roots live in Vaultwarden
Secrets the cluster needs are committed to this **public** repo, encrypted with **SOPS + age**, and Flux's kustomize-controller decrypts them as it applies them. Flux pulls with no git credentials and CI holds no cluster credentials (ADR-0007), so secrets must either ride in git encrypted or be placed by hand. Encrypting them in git keeps the cluster rebuildable from git plus one key, with no extra service to run. The roots of trust (the age key, the OpenTofu state key, the Linode and Object Storage tokens, talosconfig and kubeconfig) never enter the cluster or CI. They live in the Owner's self-hosted **Vaultwarden**.
## Considered Options
- **External Secrets Operator with a store** (Bitwarden Secrets Manager, 1Password, OpenBao). Rejected. It adds a third-party dependency or a service to run, and the cluster still needs its own credential for the store, so the bootstrap problem remains.
- **Sealed Secrets.** Rejected. The ciphertext still sits in git, and the controller's private key is generated in the cluster and has to be backed up, which makes disaster recovery worse than SOPS.
- **Secrets created by hand with `kubectl` over the tailnet.** Rejected. Nothing records what should exist, drift goes unnoticed, and rebuilding the cluster needs a manual step for each secret.
## Consequences
- **The ciphertext is public forever.** Key names and encrypted values can be read by anyone, along with every past version in history. If the age key is ever exposed, **every value it protected is rotated**. Replacing the key alone isn't enough.
- **Layout:** `.sops.yaml` encrypts only `data`/`stringData` in `deploy/**/*.sops.yaml`. The Flux Kustomizations that carry secrets set `decryption.provider: sops`.
- **The age key:** there is one, for prod, generated offline. Its durable copy is in Vaultwarden. During the Flux install runbook, the Owner creates `flux-system/sops-age` from it by hand. OpenTofu never sees it, so it stays out of Tofu state.
- **Secrets reach the app as files, never env vars.** They're mounted read-only under pydantic-settings' `secrets_dir`. Env vars leak through `/proc`, into child processes such as break-glass `psql`, and into debug output. Non-secret config such as the DB CA certificate is committed in plaintext as a ConfigMap.
- **DB credentials are split** (ADR-0004):
- `hapi-db-app` is mounted only into the app Deployment, which also hosts the admin CLI.
- `hapi-db-migrator` is mounted only into the migrate Job and a runbook admin pod used for `hapi db bootstrap` and `hapi db breakglass`.
- No workload ServiceAccount can read Secrets.
- **Git is the source of truth for DB passwords.** The Owner generates them and commits them encrypted. The idempotent `hapi db bootstrap` reads them from its mounted files and runs `CREATE`/`ALTER ROLE … PASSWORD`. The `akmadmin` password is still pasted in at run time and never stored in git or the cluster.
- **Each integration gets its own narrow credential:**
- The CCM gets a dedicated Linode token with only the scopes it needs. OpenTofu creates it, never reusing the Owner's Tofu token.
- Later credentials (DNS-01, ntfy, the backup target) are each a narrow token delivered through SOPS.
- **CI secrets** (the write deploy key, the Renovate bot token, a publish-only ntfy token for the CI topic) are repo-level Gitea Actions secrets. CI never decrypts SOPS.
- **Guardrails against plaintext:**
- gitleaks runs in pre-commit and as a required CI check.
- A second CI check fails on any `kind: Secret` manifest without SOPS metadata, or any `*.sops.yaml` that isn't encrypted.
- A plaintext secret that reaches `main` is rotated. Rewriting history doesn't help, because clones and caches already have it.
- **Rotation is manual and event-driven**, with no schedule. It happens on suspicion of exposure, when the age key is exposed, or when who has access changes.
- **For a DB password:** merge the new SOPS value, wait for Flux, run `hapi db bootstrap` (which runs `ALTER ROLE`), then `kubectl rollout restart`.
- **The cost:** new connections fail for a few seconds between the last two steps, which is accepted. There's no Reloader controller.
- **Owner roots:** kubeconfig and talosconfig sit on local disk only while in use. Vaultwarden is cloud-hosted with its own backups. An additional offline copy (paper or encrypted USB, kept away from home) holds the age key, the OpenTofu state passphrase and the Linode account recovery codes, and is updated whenever one of them rotates.
-28
View File
@@ -1,28 +0,0 @@
# Probes on an internal port, authenticated three-state health, self-hosted Victoria stack
ADR-0002 allows no anonymous public endpoints, but kubelet probes can't carry a Token. So hAPI listens on two ports. **`:8000`** serves the API and is the only port the Gateway routes. **`:8081`** is internal: it is never routed, and a NetworkPolicy limits it to kubelet and the metrics scraper. It serves `/livez`, `/readyz` and `/metrics` without auth, from the **same process and event loop** as the API, so a wedged loop fails liveness. External health is **`GET /v1/health`** on the public API. It needs the `health` Scope, and it reports `ok`, `degraded` or `down` using only check names and `ok`/`fail`. Uptime Kuma, a Bot on its own public VM, polls it. Logs and metrics go to **VictoriaLogs and VictoriaMetrics**, self-hosted in the cluster. The Owner reads them through Grafana over a port-forward on the management tailnet. We chose this stack over Prometheus + Loki because it fits beside hAPI on two 4 GB workers, and over a SaaS because logs carry Principal ids and the breakglass audit trail (ADR-0004), which shouldn't leave the cluster.
## Considered Options
- **Probes on the public port, unauthenticated.** Rejected: it breaks ADR-0002's "no anonymous endpoints" rule. A probe path the Gateway happens not to route is also easier to expose by mistake than a port it never routes.
- **Readiness that checks the database.** Rejected: one blip of the managed database would mark every pod unready at once, and the NodeBalancer would serve nothing. A 503 with an RFC 9457 body is more honest. Database health goes into `/v1/health` and metrics instead.
- **Separate health endpoints per concern** (e.g. one for the HA bridge). Rejected in favour of one endpoint with critical and non-critical checks, which gives Kuma a "degraded" signal without a second route.
- **Prometheus + Loki (+ Alloy).** The industry standard. Rejected for v1 on footprint: it needs about 1.5–2 GB before tuning, on workers that also run hAPI, Flux and Cilium.
- **Grafana Cloud or another SaaS.** Rejected: it would put a vendor in the data path for Principal ids and audit events.
- **Built-in vmui / VictoriaLogs UI only.** Workable, but provisioned dashboards earn Grafana its place.
- **Write-once off-cluster storage for breakglass audit events.** Deferred: the Owner controls the cluster and is the one who runs breakglass. In v1, tamper-evidence comes from a Household ntfy alert on every breakglass start.
## Consequences
- **`/livez`** returns a constant. **`/readyz`** passes once startup is done (config loaded, pools created). On SIGTERM, `/readyz` fails first and the pod drains for about 5 s before it shuts down. Readiness also gates rollouts (ADR-0007): an image that never becomes Ready stalls the rollout.
- **`/v1/health`** checks `db` (a `SELECT 1` through the app pool) and `schema` (at the expected Alembic head). These are critical: if either fails, the status is `down` with HTTP 503. It also checks `ha_bridge` (no poll for 5 min, see ADR-0006) and `job_backlog` (oldest pending Job too old). These are non-critical: if one fails, the status is `degraded` with HTTP 200. Bodies carry no error text, hostnames, versions or latencies. Kuma points two monitors at it: *up* (HTTP status) and *healthy* (a JSON query asserting `status == "ok"`).
- **Collection:** vmagent scrapes the app, kubelet/cAdvisor, kube-state-metrics, node-exporter, Flux and Cilium. A Vector DaemonSet takes pod stdout and Talos service logs (`machine.logging`, JSON over TCP). An event exporter ships Kubernetes Events as logs. Everything lives in a `monitoring` namespace on Block Storage PVs and arrives as Flux `HelmRelease`s.
- **App metrics** come from `prometheus-client`: requests by route template, method and status; latency; DB pool usage; Job depth, age and failures; seconds since HA's last poll; auth failures by reason. **Labels never carry `principal_id` or Personal data.** Per-Principal detail stays in logs.
- **Retention:** logs and metrics are kept for 30 days, breakglass audit events for 1 year.
- **Locked down:** Grafana requires login, with analytics, update checks and Gravatar off. Datasource plugins are pinned in the image. Outbound traffic from `monitoring` is denied by default, except vmalert → ntfy and the Watchdog → Kuma push.
- **Every failure has one alerting owner.**
- Kuma: reachability and degraded status.
- Flux notification-controller: failed reconciles, migrate Jobs and rollouts.
- vmalert: PVs filling, crash loops, the DB pool near ADR-0004's budget, Jobs piling up or failing, a node NotReady.
- Watchdog: an always-firing alert pushes to a Kuma push monitor, so the monitoring stack dying is caught from outside. The push URL is a SOPS secret (ADR-0008).
- **Never public:** `:8081`, Grafana, VictoriaMetrics and VictoriaLogs. They're reachable only by `kubectl port-forward` over the management tailnet.
-181
View File
@@ -1,181 +0,0 @@
# Which sources can feed posted Transactions from our banks and cards?
Research for [#65](https://git.bobbypalko.com/bobby/hapi/issues/65), part of the Finance map (#44). Researched 2026-11-24.
**Question.** For each institution (joint, the priority: Capital One and Fulton Bank; personal: Diamond Credit Union, Chase and Apple Card), what routes let an importer Bot running outside hAPI fetch **posted** Transactions? For each route:
- Does it give the purchase/transaction date as well as the posted date?
- Does it give a stable per-transaction id that works as an idempotent `external_id`, and does that id survive pending to posted?
- Can pending transactions be filtered out?
- What is the auth model, and which credential does the Bot (or a third party) hold? Is it read-only, what does it cost, and do the ToS allow personal use?
**How to read this.** Sections 1 to 3 are **facts**, each with its source. Section 4 lists what I **could not verify**. Section 5 is **recommendation**, which is my judgement and not a sourced fact. "Unverified" means I found no first-party source; it does not mean the thing is false.
---
## 1. Routes, one at a time (facts)
### 1.1 SimpleFIN Bridge (aggregator for individuals)
| Question | Answer | Source |
|---|---|---|
| Purchase date | `transacted_at` is **optional**: "when the transaction happened". `posted` is required: "when the transaction posted to the account" (`0` if pending). | [SimpleFIN protocol](https://www.simplefin.org/protocol.html) (v2.0.0-draft, last changed 2026-03-19) |
| Stable id | `id` is required: "An ID that uniquely describes a transaction within an Account". It is unique **per account**, not globally. The spec does not say whether the id survives pending to posted. | same |
| Pending filter | Yes, on the server side. `GET /accounts` **excludes pending by default**; `pending=1` opts in. | same |
| Auth / credential | The user makes a one-time Setup Token. The app POSTs to its claim URL once and gets an **Access URL** that embeds HTTP Basic credentials. That Access URL is the only secret the Bot holds. "Your application never sees the user's bank account credentials." The user can disable the token at any time. | [SimpleFIN developer guide](https://beta-bridge.simplefin.org/info/developers), [protocol](https://www.simplefin.org/protocol.html) |
| Who holds bank credentials | SimpleFIN says "We outsource to MX to securely store and access your financial institutions" and "No bank account credentials ever touch our servers." | [SimpleFIN security](https://beta-bridge.simplefin.org/info/security) |
| Read-only | Yes. The protocol exists to "share read-only financial data", and it defines no write operations. | [protocol](https://www.simplefin.org/protocol.html) |
| Limits | Meant for daily updates, at about 24 requests a day or fewer. Each request can cover at most **90 days**. Going far over the limit disables the token. | [developer guide](https://beta-bridge.simplefin.org/info/developers) |
| Cost | **$1.50 a month or $15 a year** plus tax, for up to 25 institutions and 25 apps. | [SimpleFIN Bridge home](https://beta-bridge.simplefin.org/) |
| ToS | The terms don't mention personal or self-written clients. They forbid access "using a method other than the interface and the instructions that we provide" and require staying within usage limits. A personal Bot that uses the documented protocol fits that wording. Liability is capped at the fees paid. | [SimpleFIN terms](https://beta-bridge.simplefin.org/info/terms) |
| Security history | A 2026-05-28 incident report says a bug may have let **up to 39 users see each other's transaction data, balances and names**. Per MX, no bank credentials were exposed. | [SimpleFIN security](https://beta-bridge.simplefin.org/info/security) |
### 1.2 Plaid (aggregator, developer account)
| Question | Answer | Source |
|---|---|---|
| Purchase date | Yes. For a posted transaction, `date` is the **posted** date and `authorized_date` is "the date that the transaction was authorized". Matching `datetime` and `authorized_datetime` fields exist, but may carry default times. | [Plaid Transactions API](https://plaid.com/docs/api/products/transactions/) |
| Stable id | `transaction_id` is unique, but **a posted transaction is a new transaction with a new id**. Plaid removes the pending one and links them through `pending_transaction_id`. If you only ingest posted transactions, the posted id is stable. | [Plaid transaction states](https://plaid.com/docs/transactions/transactions-data/) |
| Pending filter | There is a `pending` boolean on every transaction, so the client filters. **Capital One provides no pending data through Plaid at all.** | [Plaid transaction states](https://plaid.com/docs/transactions/transactions-data/), [Plaid OAuth guide: Capital One](https://plaid.com/docs/link/oauth/) |
| Auth / credential | The Bot holds a Plaid `client_id` and secret plus a per-Item `access_token`. Chase and Capital One are **OAuth institutions**. To use them you need Production access, a company profile, application display info, a signed Master Services Agreement and the **security questionnaire**. Chase consent lasts 6 or 12 months. Capital One consent must be refreshed yearly. | [Plaid OAuth guide](https://plaid.com/docs/link/oauth/) |
| Read-only | The Transactions product is read-only. The same Plaid account can also enable money-moving products (Transfer). | [Plaid docs](https://plaid.com/docs/link/oauth/) |
| Cost | Transactions is a **per-Item monthly subscription**, billed while an access token exists. The Trial plan allows **10 Production Items**, with live data. Pay-as-you-go has no minimum and is described as "Best for individuals and solo developers". Unit prices are shown only in the Dashboard. | [Plaid billing](https://plaid.com/docs/account/billing/), [Plaid pricing](https://plaid.com/pricing/) |
| ToS | Development accounts are "solely for internal evaluation" and not for production. Production requires a compliance review. Nothing I found rules out an individual, but the OAuth registration assumes a company. | [Plaid developer terms](https://plaid.com/legal/terms-of-use), [OAuth guide](https://plaid.com/docs/link/oauth/) |
### 1.3 Teller (aggregator, developer tier)
| Question | Answer | Source |
|---|---|---|
| Purchase date | There is a **single** `date` field: "The ISO 8601 date of the transaction". Teller's sync guidance says "When a pending transaction posts, its date often changes to the posting date." In practice a posted transaction may carry only the posted date. | [Teller Transactions API](https://teller.io/docs/api/account/transactions) |
| Stable id | "Teller maintains stable transaction IDs. Occasionally, when a pending transaction changes significantly upon posting and cannot be matched to the original, it's created as a new record with a new ID." | same |
| Pending filter | `status` is `posted` or `pending`, and the client filters. There is no server-side filter parameter. | same |
| Auth / credential | **mTLS client certificate** plus a per-enrollment access token sent over HTTP Basic. "Access tokens are useless without a Teller client certificate." Enrollment happens through Teller Connect. | [Teller authentication](https://teller.io/docs/api/authentication) |
| Read-only | Not stated for the token scope. Teller has a Payments product (beta). | same |
| Cost | The developer tier includes **100 live connections free** ("free for independent developers"). After that, Transactions costs **$0.30 per enrollment per month**. | [teller.io](https://teller.io/) |
| ToS | Not reviewed (see section 4). | |
### 1.4 File exports (CSV / OFX / QFX / QBO)
Common facts about OFX, which QFX and QBO are built on. Each `STMTTRN` carries **`FITID`** (the institution's transaction id), **`DTPOSTED`** (posted date) and an optional **`DTUSER`** ("date user initiated transaction, if known"). Sources: OFX field definitions as reproduced in the [Haskell `ofx` package docs](https://hackage.haskell.org/package/ofx-0.4.0.4/docs/ofx.haddock) (which cite OFX spec §11.4.2.3.1.1), and a [libofx sample OFX 2.0.1 statement](https://stuff.mit.edu/afs/sipb/project/libofx/src/libofx-0.8.0/doc/ofx_sample_files/ofx_spec201_stmtrs_example.xml). Both are secondary; I did not open the OFX spec PDF itself. An export file contains whatever the bank chose to include, and exports are generally posted-only. Whether `DTUSER` is filled in depends on the institution.
Per-institution export facts are in section 2.
### 1.5 Apple FinanceKit (on-device, Apple Card / Apple Cash / Savings)
| Question | Answer | Source |
|---|---|---|
| Purchase date | Yes. `transactionDate: Date` (non-optional) is "The time the transaction took place… This may be different from the time the transaction posted." `postedDate: Date?` is the posted date; "If not provided, use `transactionDate` as `postedDate`." | [Transaction](https://developer.apple.com/documentation/financekit/transaction), [transactionDate](https://developer.apple.com/documentation/financekit/transaction/transactiondate), [postedDate](https://developer.apple.com/documentation/financekit/transaction/posteddate) |
| Stable id | `id: UUID` is "A unique internal ID". WWDC24 says it is "unique for every transaction, but **unique per device** as well… especially useful to track how a given transaction evolves over time." `transactionHistory(forAccountID:since:)` returns `Changes` with `inserted`, `updated` and `deleted` plus a resumable `HistoryToken`, so a status change should arrive as an *update* to the same id. That last point is inferred from the API shape; Apple does not say it outright. | [id](https://developer.apple.com/documentation/financekit/transaction/id), [Meet FinanceKit (WWDC24)](https://developer.apple.com/videos/play/wwdc2024/2023/), [FinanceStore.Changes](https://developer.apple.com/documentation/financekit/financestore/changes) |
| Pending filter | Yes. `TransactionStatus` has `authorized`, `booked`, `memo`, `pending` and `rejected`. Posted means `booked`. | [TransactionStatus](https://developer.apple.com/documentation/financekit/transactionstatus) |
| Other fields | `accountID`, `creditDebitIndicator`, `transactionAmount`, `foreignCurrencyAmount`, `merchantName`, `merchantCategoryCode`, `transactionDescription`, `originalTransactionDescription`, `transactionType`. | [Transaction](https://developer.apple.com/documentation/financekit/transaction) |
| Auth / credential | Two gates. First, an **entitlement** that the developer Account Holder requests, granted per bundle ID. Second, per-user authorization on the device, where the user picks the accounts and the earliest date shared and can revoke in Settings. The data is read from the on-device store and "never seen by Apple". | [Get started with FinanceKit](https://developer.apple.com/financekit/), [WWDC24](https://developer.apple.com/videos/play/wwdc2024/2023/) |
| **Eligibility** | The app must "Be listed in the Finance category in App Store Connect and **distributed through the App Store** for iPhone in the United States or United Kingdom" and "Provide financial management tools". The US requires iOS 17.4+ and excludes Apple Card Family participants. | [Get started with FinanceKit](https://developer.apple.com/financekit/) |
| History | "FinanceKit tries to preserve… at least some months of history"; history "can be compacted by the system". | [WWDC24](https://developer.apple.com/videos/play/wwdc2024/2023/) |
| Shortcuts | iOS 17 added a **Transaction** personal automation that "can run when a Wallet transaction is made". It fires at tap time, so it is an authorization and **not a posted** transaction. I found no Apple-documented Shortcuts action that reads FinanceKit history. | [What's new in Shortcuts for iOS 17](https://support.apple.com/en-us/HT213909) |
---
## 2. Per institution (facts)
### Capital One (joint, priority)
- **Official API / MCP.** The DevExchange consumer-transactions API is **partner-gated**: production access requires partner approval and pricing is negotiated ([API Evangelist profile of DevExchange](https://github.com/api-evangelist/capital-one), secondary). **I found no official Capital One MCP server**. Every "Capital One MCP" I found is third-party, such as [hashwnath/capitalone-mcp-server](https://github.com/hashwnath/capitalone-mcp-server), which wraps sandbox and partner APIs and has no personal transactions tool, or connectors built on GoCardless. Capital One's portal ([developer.capitalone.com](https://developer.capitalone.com/)) is a JS app that I could not search. See section 4.
- **Aggregators.** Capital One shares data with Plaid under a data-sharing agreement, through its API ([Capital One newsroom](https://www.capitalone.com/about/newsroom/data-sharing-agreement/), 2021). Through Plaid it is OAuth, gives **no pending data**, and needs consent refreshed yearly ([Plaid OAuth guide](https://plaid.com/docs/link/oauth/)). Capital One itself uses **MX** and Mastercard for its inbound external-accounts feature ([Capital One external-accounts T&C](https://www.capitalone.com/digital/external-accounts-terms-conditions/), modified 2026-07-29). That shows a working MX relationship, but it is not proof that SimpleFIN (via MX) can pull *from* Capital One. SimpleFIN and Teller coverage: unverified.
- **File export.** Credit card CSV columns are **Transaction Date, Posted Date, Card No., Description, Category, Debit, Credit**. There is **no transaction id**. Source: [Tiller guide, 2026-05-23](https://tiller.com/export-capital-one-transactions/), secondary. Users also report QFX, OFX and QBO downloads ([Quicken community](https://community.quicken.com/discussion/7852368/can-i-download-transactions-from-capital-one-accounts)). The 360 bank-account CSV columns are unverified.
### Fulton Bank (joint, priority)
- **Official API.** None found for consumers.
- **Quicken / QuickBooks.** Fulton's personal online-banking product sheet lists **Web Connect** ("Log into Online Banking and export your transactions to Quicken or QuickBooks") and **Direct Connect** ("Import your transactions right to Quicken® or QuickBooks® without ever logging into Online Banking"). Fulton's guides say **a Direct Connect fee applies** to personal accounts. Source: [Fulton Online Banking sheet](https://www.fultonbank.com/-/media/Files/Product-Info-Sheets/Online-Banking.ashx) and [consumer guide](https://www.fultonbank.com/-/media/Files/Blue-Foundry/consumer-guide.pdf). Both URLs **return 404 as of 2026-11-24**; the quotes come from the search index. Business (BOSS) exports offer CSV, BAI, QuickBooks and Quicken (OFX) formats ([BOSS Download/Export guide](https://www.fultonbank.com/-/media/Files/Commercial/BOSS/Download-Export/BOSS-User-Guide---Download_Export.pdf), business only).
- **Context.** Fulton's Blue Foundry transition guides refer to a conversion starting July 2026. Expect digital-banking changes.
- **Aggregators.** SimpleFIN, Plaid and Teller coverage are all unverified.
### Diamond Credit Union (personal)
- **Official API.** None.
- **Export.** Diamond's public site ([online banking](https://diamondcu.org/personal/online-banking/), [FAQ](https://diamondcu.org/about/faq/), [account tools](https://diamondcu.org/account-management/)) documents **no transaction export, Quicken/QuickBooks or third-party-app feature** for personal members. The listed features are balances, activity, transfers, deposits, card controls and bill pay. A Diamond business page (now 404) reportedly offered Quicken/QuickBooks download "free with your Diamond Business Checking Account". Digital banking runs at `digital.diamondcu.org`.
- **Aggregators.** Coverage is unverified everywhere.
### Chase (personal)
- **Official API.** None for consumers. Chase charges aggregators for data access. Its Plaid agreement was extended in September 2025 with a pricing structure, and Plaid said it would not pass the cost on ([JPMorganChase/Plaid release](https://www.businesswire.com/news/home/20250916390149/en/JPMorganChase-and-Plaid-Announce-an-Extension-to-their-Data-Access-Agreement-for-Sharing-of-Consumer-Permissioned-Data)). Through Plaid, Chase is OAuth: consent lasts 6 or 12 months and you need the security questionnaire ([Plaid OAuth guide](https://plaid.com/docs/link/oauth/)). Teller's docs use Chase in example payloads, but I could not confirm Teller's live support. SimpleFIN coverage is unverified.
- **File export.** The download icon on account activity offers CSV, QFX, QBO and QIF, for both card and bank accounts ([GnuCash list, 2023](https://lists.gnucash.org/pipermail/gnucash-user/2023-August/108468.html), secondary). Community parsers report the card CSV columns as **Card, Transaction Date, Post Date, Description, Category, Type, Amount, Memo**, with **no id** ([pfin chase parser](https://beta.pkg.go.dev/git.sr.ht/~mendelmaleh/pfin/parser/chase), secondary). Checking CSV columns are unverified.
### Apple Card (personal)
- **FinanceKit** is the only programmatic route (section 1.5). It requires an **App Store–distributed Finance-category app**.
- **File export.** From Wallet (Card Balance, then a statement or Statements, then Export Transactions) or from **card.apple.com** (Statements, then Export Transactions), for a monthly statement **or a start/end date range** ([Apple Support 102284](https://support.apple.com/en-us/102284)). Apple's page does not name the formats. Coverage dating from the 2020 launch lists **CSV, OFX, QFX and QBO** ([MacRumors, 2020](https://www.macrumors.com/2020/02/11/apple-card-now-supports-ofx-exporting/)). Users report the CSV columns as **Transaction Date, Clearing Date, Description, Merchant, Category, Type, Amount (USD)**, with **no id** ([Apple Discussions](https://discussions.apple.com/thread/251068204?page=2), secondary). OFX `FITID` content is unverified.
- **Aggregators.** None. Apple Card is not reachable through Plaid, Teller or SimpleFIN. This is implied by FinanceKit being the only route, and I found no aggregator claiming Apple Card.
### Regulatory backdrop
The CFPB's §1033 Personal Financial Data Rights rule, which would require banks to offer data APIs, **is not in force**. It was enjoined on 2025-10-29 and is being reconsidered, and the 2026-04-01 compliance date passed without enforcement ([CFPB](https://www.consumerfinance.gov/personal-financial-data-rights/), [Cozen O'Connor, 2026](https://www.cozen.com/news-resources/publications/2026/section-1033-compliance-date-open-banking-rule-enjoined-and-under-reconsideration)). No bank is obliged to give individuals a direct API.
---
## 3. Summary table (facts; "?" = unverified)
"Purchase date" means the route can give a purchase date distinct from the posted date. "Id stable p→p" means the id survives pending to posted. That doesn't matter for a posted-only ingest, as long as the posted id is stable.
| Institution | Route | Purchase date | Txn id / stable p→p | Pending filter | Bot holds | Cost | Coverage |
|---|---|---|---|---|---|---|---|
| **Capital One** | SimpleFIN | `transacted_at` optional, ? if populated | `id` per account / ? | server-side, default off | Access URL (read-only) | $15/yr total | ? |
| | Plaid | `authorized_date` | yes / new id on post (no pending at C1 anyway) | n/a (no pending at C1) | client secret + access_token; OAuth, needs company and questionnaire | per-Item monthly, price in Dashboard; trial 10 Items | yes (OAuth) |
| | Teller | single `date`, often becomes posted date | mostly stable | client-side `status` | mTLS cert + token | free ≤100 connections | ? |
| | CSV | Transaction Date + Posted Date | **none** | export is posted | nothing (manual download) | free | yes (card) |
| | OFX/QFX | `DTUSER` ? | `FITID` | posted | nothing (manual) | free | reported |
| | Official API / MCP | — | — | — | partner only; **no official MCP found** | — | no |
| **Fulton** | Web Connect (QFX/QBO) | `DTUSER` ? | `FITID` | posted | nothing (manual) | free | yes (bank-documented, page now 404) |
| | Direct Connect | as OFX | `FITID` | posted | OFX login | fee | yes, but whether non-Intuit clients work is ? |
| | SimpleFIN / Plaid / Teller | as above | as above | as above | as above | as above | ? |
| **Diamond CU** | any | ? | ? | ? | ? | ? | nothing documented |
| **Chase** | Plaid | `authorized_date` | new id on post | `pending` flag | as above, OAuth 6/12-month consent | as above | yes (OAuth) |
| | CSV / QFX / QBO | CSV: Transaction Date + Post Date | CSV **none**; QFX `FITID` | posted | nothing (manual) | free | yes |
| | SimpleFIN / Teller | as above | as above | as above | as above | as above | ? |
| **Apple Card** | FinanceKit | `transactionDate` + `postedDate` | UUID, **per device**; updates in place (inferred) | `status == .booked` | on-device auth; app needs entitlement and App Store distribution | Apple Developer Program | yes, but a private app is likely ineligible |
| | Wallet / card.apple.com export | CSV: Transaction Date + Clearing Date | CSV **none**; OFX `FITID` ? | statements are posted | nothing (manual) | free | yes |
---
## 4. Could not verify
- **SimpleFIN institution coverage** for all five institutions. The Bridge's search form is behind Cloudflare Turnstile and returned "No institutions found" even for "bank" when scripted. → Sign in at https://beta-bridge.simplefin.org/search-institutions and search manually.
- **Whether SimpleFIN/MX populates `transacted_at`**, and whether SimpleFIN `id`s survive pending to posted. → Check the raw `/accounts` JSON once connected.
- **Teller institution coverage** (`GET https://api.teller.io/institutions` timed out from here) and Teller's ToS.
- **A Capital One MCP server.** I found no first-party announcement, docs page or newsroom item, and the developer portal can't be scripted. If the owner has a link, the conclusion changes.
- **Fulton's current personal export formats and Direct Connect fee.** The bank PDFs now 404. Also whether Fulton's Direct Connect accepts non-Intuit OFX clients.
- **Diamond CU's export options** inside digital banking (they may exist behind login), and any aggregator support.
- **Apple Card export formats and columns** from a first-party source, and whether its OFX `FITID` is stable across re-exports.
- **Whether FinanceKit's `pending` to `booked` change arrives as an update to the same id.** This is inferred from the `Changes` API, not stated by Apple.
- **Whether FinanceKit's entitlement can be granted to an individual or unlisted app.** The criteria require App Store distribution in the Finance category.
- **Chase and Capital One 360 checking CSV columns.**
- **Plaid's actual per-Item Transactions price**, which is only visible in the Dashboard.
---
## 5. Recommendation (judgement, not fact)
**First importer route for the joint accounts: SimpleFIN Bridge, gated on a coverage check, with OFX/QFX file import as the fallback and the history backfill.**
Why SimpleFIN first:
- **Security.** It is the smallest credential the Bot can hold: a single read-only Access URL that the owner can revoke. No mTLS keypair and no client secret that could also enable money movement. hAPI still holds no bank credentials, and the Bot holds no bank login either; MX does. The trade-off is trusting SimpleFIN and MX. The May 2026 cross-user exposure incident is a real cost to weigh.
- **Posted-only by default** (`pending` off), which matches the ingest contract with no client filtering.
- **Cost and ToS.** $15 a year, designed for individuals. Plaid's OAuth path for Capital One and Chase needs a company profile, an MSA and a security questionnaire, which is out of proportion for one household. Teller's single `date` field loses the purchase date once a transaction posts, which hurts a required `occurred_on`.
How to map it:
- `external_id = simplefin:{account.id}:{transaction.id}`. Namespace by account, because the id is only unique within an account.
- `occurred_on = transacted_at` when present. Otherwise the Bot must decide between falling back to `posted` and flagging the transaction. That is an open question for the Finance map.
- `posted_on = posted`.
- Pull daily with a window of a few days. Each request covers at most 90 days.
**First step, about 10 minutes for the owner:** sign in to SimpleFIN Bridge and search for "Capital One" and "Fulton". Connect one account and inspect a raw `/accounts` response for `transacted_at` and the shape of `id`.
If SimpleFIN doesn't cover one of them, or omits `transacted_at`: use **OFX/QFX export** for that bank. Both joint banks offer it: Capital One QFX and Fulton Web Connect. It gives `FITID`, usable as `external_id = ofx:{acctid}:{fitid}`, plus `DTPOSTED` and possibly `DTUSER`. The Bot becomes a file-drop importer. It is semi-manual but has zero standing credentials. Prefer OFX/QFX over CSV, because the CSVs carry no transaction id. Use the file route for the one-off **history backfill** in any case, because SimpleFIN's per-request window is 90 days.
Later, for the personal accounts:
- Chase follows the same order as the joint accounts.
- Diamond CU needs the owner to check what digital banking offers behind login.
- Apple Card is realistically **Wallet/card.apple.com export (OFX or CSV)**. FinanceKit needs an App Store–listed Finance app, and its ids are per device, so re-pairing a phone would mint new `external_id`s.
+105
View File
@@ -0,0 +1,105 @@
# Linode (Akamai Cloud) Managed PostgreSQL: networking, security, backups
Research for issue #49 (part of #44). Researched 2026-11-23 against Akamai TechDocs, the Akamai pricing page, and the `linode/terraform-provider-linode` repo (latest release v4.10.0, published 2026-11-19).
## Which generation this covers
There are two Linode/Akamai Managed Database generations. The API reports which one you have in the `platform` field: `rdbms-legacy` or `rdbms-default` ([API: create PostgreSQL DB][api-create]).
- **Legacy** (`rdbms-legacy`): the original Linode DBaaS. Akamai is migrating these databases to the new system. Some legacy endpoints, such as the database backups endpoints, aren't supported in the new product and will be deprecated ([changelog 2024-11-14][cl-2024]).
- **Current** (`rdbms-default`): Akamai "reintroduced" the service on 2024-11-14, built with Aiven, in 20 core compute regions ([changelog 2024-11-14][cl-2024], [cluster overview][overview]).
**Everything below applies to the current (Aiven-based) generation only.** Older guides and blog posts that describe the legacy product (for example, ones listing PG 13 or a backups API) don't apply to it.
## Bottom line for hAPI
- **Private access is possible, through a VPC.** A database cluster can be attached to a VPC in the same region (`private_network.vpc_id` / `subnet_id`). Its hostname then resolves to a private IPv4 address in the VPC subnet, and public access is off unless `public_access = true` ([manage clusters][manage], [API: create][api-create]). Our self-managed Kubernetes nodes are plain Linode Compute instances, and "Linodes can join a VPC by specifying the VPC as a network interface" ([VPC][vpc]). So the nodes need a VPC interface in the same VPC and region as the database.
- **Caveat: VPC for Managed Databases launched as beta (2025-09-30), and I found no GA announcement.** The API changelog says use of `private_network` "is in beta" and "may cause disruptions in certain production environments" ([API changelog 2025-09-30][api-cl-vpc], [cloud changelog 2025-09-30][cl-vpc]). The current manage-clusters page doesn't label it beta, but no changelog entry declares it GA. Treat it as beta until you see a GA entry.
- **Without a VPC: public endpoint plus an IP allowlist.** Each cluster has an ACL, and "by default, all connections both public and private are blocked unless they appear on this list" ([manage clusters][manage]). The ACL still applies when a VPC is attached, so add the VPC subnet CIDR to `allow_list` (inference from that quote, not stated outright).
- **The LKE auto-allowlist doesn't help us.** Akamai rewrites each database's ACL every 10 minutes with the IPs of all **LKE** nodes in the account ([manage clusters][manage]). hAPI runs self-managed Kubernetes on Compute, not LKE, so node IPs have to be managed ourselves (for example with Terraform `linode_database_access_controls`). Also note that if LKE is ever used in the same account, every LKE node is allowlisted on every database automatically. Opting out requires a support ticket.
- **TLS is mandatory.** `ssl_connection` is "currently required to be `true`". A CA certificate is downloadable from Cloud Manager or available as the Terraform `ca_cert` attribute, so clients can use `sslmode=verify-full` ([API: create][api-create], [PostgreSQL doc][pg], [TF resource][tf]).
- **Backups:** daily backups, kept 14 days, with point-in-time restore inside that window. Restores always create a new (forked) cluster ([overview][overview], [manage clusters][manage]).
- **Cheapest option:** Shared 1 GB at $16/mo for one node or $37/mo for three nodes (HA). That plan has 9 GB of usable storage ([pricing][pricing]).
## Versions
- PostgreSQL **15, 16, 17, 18** are supported ([engines and plans][engines]). Engine IDs look like `postgresql/16`; the live list comes from the List engines API ([API: create][api-create]).
- Major-version upgrades run in place, start immediately when you click Upgrade, and can't be reverted. A failed compatibility check rolls back. Discontinued versions are upgraded automatically during the maintenance window ([manage clusters][manage]). I found no published version EOL schedule.
## Plans and HA
- Plan families: Shared CPU and Dedicated CPU; premium Linode types are also accepted ([engines and plans][engines], [API changelog 2025-09-30][api-cl-vpc]). Ranges: Dedicated 1-3 nodes, 4-512 GB RAM, 80-7200 GB storage. Shared 1 or 3 nodes, 1-192 GB RAM, 25-7200 GB storage ([overview][overview]).
- `cluster_size`: `1`, `2`, or `3`. `3` means one primary and two standbys. `2` is dedicated-only ([API: create][api-create]). Three-node clusters give "data redundancy and automatic failover" ([overview][overview]).
- HA tuning through `engine_config`: `pglookout.max_failover_replication_time_lag` (TF default 60 s) and `synchronous_replication` (`quorum` or `off`, three-node only) ([API: create][api-create], [TF resource][tf]).
- Single-node clusters have downtime during maintenance and resizes ([manage clusters][manage]).
## Networking details
- The VPC must be in the same region as the cluster. You can assign, change, or unassign a VPC after creation, but "any change of the networking settings causes a temporary downtime" ([manage clusters][manage]).
- With `public_access = true`, a second hostname is published. Swap the `private-` prefix for `public-` to get it ([manage clusters][manage]). The API `endpoints` array (added 2026-03-31) lists each address with its role and `public_access` ([API changelog 2026-03][api-cl-2026]).
- The VPC subnet doesn't automatically block outbound connections outside the subnet. Akamai recommends Cloud Firewall rules on the VPC Linodes, including blocking inbound traffic from the cluster's VPC range ([manage clusters][manage], search summary of [API: update][api-update]).
- VPC traffic "is isolated from other cloud tenants, [but] it is not encrypted", and VPC interfaces have no IPv6 ([VPC][vpc]). TLS (mandatory) covers this.
- The docs say "the connection to a database cluster over a private IP address is not supported" and recommend public IPv6 instead ([manage clusters][manage]). This sits in the ACL section, so I read it as referring to legacy Linode private IPv4 (`192.168.128.0/17`, shared by all Linodes in a region, [VPC][vpc]) rather than VPC addresses. The page doesn't define the term, though. **Verify before relying on either reading.**
- Cost: inbound transfer is free. Public IPv4 from Linodes costs egress; IPv6 (AAAA) from same-region Linodes avoids transfer charges ([overview][overview], [manage clusters][manage]). VPCs themselves cost nothing extra. Egress overage is $0.005/GB ([pricing][pricing]).
- Known issue: some PostgreSQL clients that prefer IPv6 can hang for about 3 minutes when only an IPv4 ACL entry exists ([manage clusters][manage]).
- VPCs are single-region, can't be peered, and are no longer supported in distributed regions as of 2026-04-22 ([VPC][vpc]).
## Users, roles, extensions, pooling
- The admin user is `akmadmin`. **Superuser isn't available.** Akamai says to use `akmadmin`/`defaultdb` for administration only and to create separate users and databases for applications ([PostgreSQL doc][pg]). There's no API or Terraform resource for database users or roles, so per-app roles have to be created in SQL (for example, a migration or bootstrap job running as `akmadmin`).
- The root password can be reset (a new random one is generated), but the root user can't be removed ([manage clusters][manage], [overview][overview]). Terraform exposes `root_username` and `root_password` as attributes, so the password ends up in Terraform state.
- `engine_config_pg_password_encryption` defaults to **`md5`** according to the Terraform docs. Set `scram-sha-256` explicitly ([TF resource][tf]).
- Extensions: Akamai links to Aiven's extension list instead of publishing its own ([PostgreSQL doc][pg]). `pg_stat_monitor` (toggle restarts the cluster), `pg_stat_statements` and `pg_partman` settings are exposed through `engine_config` ([TF resource][tf]).
- PgBouncer connection pools (API-managed) were added on 2026-03-31 ([API changelog 2026-03][api-cl-2026]).
- Encryption at rest: Terraform exports an `encrypted` attribute ([TF resource][tf]). I didn't find a first-party Akamai statement on at-rest encryption; the overview page only links to Aiven's encryption docs ([overview][overview]).
- There's no OS access, config files can't be edited, and replicas can't be hosted outside the service ([overview][overview]).
## Backups and restore
- Daily backups, retained 14 days, no extra cost. Point-in-time recovery for any time in that window ([overview][overview]).
- To restore, create a new database with `fork.source` and an optional `fork.restore_time` (must be newer than `oldest_restore_time`). Without `restore_time` you get the newest full backup plus incremental. A restore always makes a **new cluster**; delete the original to stop paying for both ([API: create][api-create], [manage clusters][manage]).
- A deleted database's backups are kept for 180 days, and a suspended cluster can be resumed within 180 days ([manage clusters][manage]).
- There's no off-platform or exportable backup feature and no configurable retention. For personal finance data, we'd need our own `pg_dump` to separate storage (such as Object Storage) to survive account-level loss or retention longer than 14 days. That's my inference, not an Akamai recommendation.
## Maintenance
- Window defaults to Sunday 20:00 UTC, weekly. `duration` "can only be `4`" hours and `frequency` "can only be `weekly`" via API/TF; day and hour (UTC) are configurable ([manage clusters][manage], [API: create][api-create]). The manage page says the default lasts 3 hours, which conflicts with the API's fixed 4.
- Pending updates appear in `pending_updates`, with a deadline, and can be applied manually ([TF resource][tf], [manage clusters][manage]).
## Pricing (PostgreSQL = MySQL, monthly, USD)
| Plan | vCPU / RAM / usable storage | 1 node | 2 nodes | 3 nodes |
|---|---|---|---|---|
| Shared 1 GB | 1 / 1 GB / 9 GB | $16 | n/a | $37 |
| Shared 2 GB | 1 / 2 GB / 30 GB | $32 | n/a | $74 |
| Shared 4 GB | 2 / 4 GB / 58 GB | $63 | n/a | $147 |
| G7 Dedicated 4 GB | 2 / 4 GB / 58 GB | $81.60 | $171.60 | $246 |
Source: [pricing][pricing]. The pricing page marks shared plans as "legacy hardware". Akamai also advertises a $100 trial credit.
## Terraform support
- Use `linode_database_postgresql_v2`. The v1 `linode_database_postgresql` doc no longer exists in the provider repo (404 on `main`). Remaining database resources: `database_postgresql_v2`, `database_mysql_v2`, `database_access_controls` ([provider repo docs][tf-dir]).
- `linode_database_postgresql_v2` supports `engine_id`, `region`, `type`, `cluster_size`, `allow_list`, `private_network { vpc_id, subnet_id, public_access }` (in Terraform, `subnet_id` is **required** when `private_network` is set), `fork_source` / `fork_restore_time`, `updates`, and many `engine_config_*` fields. It exports `ca_cert`, `host_primary`, `host_secondary` (private host), `root_username`, `root_password`, `port`, and `encrypted`. Provisioning "can take up to half an hour" ([TF resource][tf]).
- I didn't find PgBouncer pool resources in the provider docs listing.
## Open questions
- Is VPC for Managed Databases GA yet? No changelog entry says so, as of 2026-11-23.
- What exactly does "connection over a private IP address is not supported" mean? See the networking section above.
- Is at-rest encryption on by default? There's no first-party Akamai statement.
[overview]: https://techdocs.akamai.com/cloud-computing/docs/aiven-database-clusters
[manage]: https://techdocs.akamai.com/cloud-computing/docs/aiven-manage-database
[engines]: https://techdocs.akamai.com/cloud-computing/docs/database-engines-plans
[pg]: https://techdocs.akamai.com/cloud-computing/docs/aiven-postgresql
[vpc]: https://techdocs.akamai.com/cloud-computing/docs/vpc
[api-create]: https://techdocs.akamai.com/linode-api/reference/post-databases-postgre-sql-instances
[api-update]: https://techdocs.akamai.com/linode-api/reference/put-databases-postgre-sql-instance
[api-cl-vpc]: https://techdocs.akamai.com/linode-api/changelog/sep-30-2025-managed-databases-vpc-support
[cl-vpc]: https://techdocs.akamai.com/cloud-computing/changelog/vpc-for-dbaas
[api-cl-2026]: https://techdocs.akamai.com/linode-api/changelog/mar-2026-managed-databases-updates
[cl-2024]: https://techdocs.akamai.com/cloud-computing/changelog/nov-14-2024-database
[pricing]: https://www.akamai.com/cloud/pricing/databases
[tf]: https://github.com/linode/terraform-provider-linode/blob/main/docs/resources/database_postgresql_v2.md
[tf-dir]: https://github.com/linode/terraform-provider-linode/tree/main/docs/resources