kit/provision: coa apps have no MATOU_CONFIG_SERVER_TOKEN — org config never mirrors to the tenant #121

Closed
opened 2026-09-04 10:20:13 +00:00 by ben · 3 comments
Owner

Seen on the first real ngati-example v0.6.3 launch (2026-09-04): the backend warns

[Config] WARNING: MATOU_CONFIG_SERVER_TOKEN is not set - org config will not mirror to the config server, and email relay (if configured) will fail

The app fetched its client config from the tenant fine (coa-infra.matou.nz/ngati-example), but it has no write token, so org-config.json will never land in the tenant dir and email relay can't work for coa communities.

Question for triage/design: should the provisioner mint a per-tenant write token at /admin/tenants time and carry it into the app via the kit (kit.json → build → app env/config), or is tenant write auth handled some other way? Touches coa server (provisioner/kit), matou-infrastructure (config-server tenant auth), and matou-app (backend env plumbing) — needs a routing decision before it's implementable.

Security note: whatever carries the token, it ends up inside a publicly downloadable installer — scope it to write-only-own-tenant.

Seen on the first real ngati-example v0.6.3 launch (2026-09-04): the backend warns > [Config] WARNING: MATOU_CONFIG_SERVER_TOKEN is not set - org config will not mirror to the config server, and email relay (if configured) will fail The app fetched its client config from the tenant fine (`coa-infra.matou.nz/ngati-example`), but it has no write token, so `org-config.json` will never land in the tenant dir and email relay can't work for coa communities. Question for triage/design: should the provisioner mint a per-tenant write token at `/admin/tenants` time and carry it into the app via the kit (kit.json → build → app env/config), or is tenant write auth handled some other way? Touches coa server (provisioner/kit), matou-infrastructure (config-server tenant auth), and matou-app (backend env plumbing) — needs a routing decision before it's implementable. Security note: whatever carries the token, it ends up inside a publicly downloadable installer — scope it to write-only-own-tenant.

This was generated by AI during triage.

Triage — #121

Verification (against the codebase, 2026-09-04):

  • httpProvisioner.provision() calls POST /admin/tenants and returns only a read configUrl — it never mints or returns a write token. Confirmed: the provisioner has no write-token concept today.
  • KitSchema (packages/schema, the source of truth) has no field capable of carrying such a token; kit.json → build → app env therefore has no channel for it. Carrying a token would require a schema change plus matching build/backend plumbing.
  • Redundancy check: searched for MATOU_CONFIG_SERVER_TOKEN, config-server-token, write.token, tenant … token, and any minting logic across server/src and packages. Nothing implements this. .out-of-scope/ is empty. This is real and unbuilt — not already implemented, not previously rejected.

So the report holds: provisioned coa apps fetch client config read-only but have no write credential, so org-config.json never mirrors to the tenant and email relay cannot work.

Category ruling — enhancement

Ruled by agent under ADR 0174 — veto anytime.

  • Ruling: category enhancement (not bug).
  • Why it's a two-way door: category is revertible by a single label swap and carries no credential/security/data-destruction residue.
  • Why enhancement: the config-mirror + email-relay path for coa tenants was never wired — there has never been a code path that mints or carries a write token — so this is net-new plumbing, not a regression. Consistent with the sibling phase-3/4 tickets (#117–#122).
  • What proves it: git log/grep show no prior token-minting implementation to have regressed from.

Why human

The state is a genuine one-way door: this needs a cross-repo security-architecture routing decision that Ben must rule, and it is not rulable by an agent under ADR 0174 because it sits on this repo's one-way-door list on three counts:

  • Credential bytes / security widening — whatever carries the token ends up inside a publicly downloadable installer. Deciding the auth model (mint-time, transport, scoping) is a security-posture decision that is not provable safe by any existing test/drive/probe.
  • Shared-infra tenants — it changes matou-infrastructure (config-server tenant write auth), protected shared infra.
  • Cross-repo routing — it spans coa server (provisioner/kit), matou-infrastructure (tenant write auth), and matou-app (backend env plumbing); the reporter already flags it as "a routing decision before it's implementable."

Human residue for Ben: approve (a) whether /admin/tenants mints a per-tenant write token, (b) the token's scope guarantee (write-own-tenant-only), and (c) that a scoped write token may ship inside a publicly downloadable installer.

Proposed default (revise or veto)

Adopt the approach the report already sketches:

  1. POST /admin/tenants mints a per-tenant write token scoped to write-own-tenant-only and returns it alongside the configUrl.
  2. ProvisionResult carries the token; a new field on KitSchema (packages/schema, source of truth) carries it into kit.json.
  3. The build (coa-builds) reads it from the kit and sets MATOU_CONFIG_SERVER_TOKEN in the app's backend env/config.
  4. config-server (matou-infrastructure) enforces the write-own-tenant-only scope server-side — the installer being public means the scope is the only real defence.

Acceptance criteria (once Ben rules the design):

  • Provisioning a tenant yields a write token scoped to that tenant only; a token cannot write another tenant's org-config.json (server-side enforced).
  • The token flows provisioner → ProvisionResult → KitSchema/kit.json → build → app MATOU_CONFIG_SERVER_TOKEN.
  • A freshly provisioned coa app no longer emits the MATOU_CONFIG_SERVER_TOKEN is not set warning and successfully mirrors org-config.json.
  • Token bytes never appear in an issue, commit, or log.

Out of scope: email-relay feature behaviour itself; feature toggles / nav order (phase 4); any tenant read-path change.

Why not delegable: the design decision is a security-posture + shared-infra one-way door (above). Once Ben rules, the implementation will still need ready-for-session standing (config-server infra + cross-repo, per the machinery-changes convention), not a swarm worker.

> *This was generated by AI during triage.* ## Triage — #121 **Verification (against the codebase, 2026-09-04):** - `httpProvisioner.provision()` calls `POST /admin/tenants` and returns only a read `configUrl` — it never mints or returns a write token. Confirmed: the provisioner has no write-token concept today. - `KitSchema` (`packages/schema`, the source of truth) has no field capable of carrying such a token; `kit.json` → build → app env therefore has no channel for it. Carrying a token would require a schema change plus matching build/backend plumbing. - Redundancy check: searched for `MATOU_CONFIG_SERVER_TOKEN`, `config-server-token`, `write.token`, `tenant … token`, and any minting logic across `server/src` and `packages`. Nothing implements this. `.out-of-scope/` is empty. This is real and unbuilt — not already implemented, not previously rejected. So the report holds: provisioned coa apps fetch client config read-only but have no write credential, so `org-config.json` never mirrors to the tenant and email relay cannot work. ## Category ruling — enhancement Ruled by agent under ADR 0174 — veto anytime. - **Ruling:** category `enhancement` (not `bug`). - **Why it's a two-way door:** category is revertible by a single label swap and carries no credential/security/data-destruction residue. - **Why enhancement:** the config-mirror + email-relay path for coa tenants was never wired — there has never been a code path that mints or carries a write token — so this is net-new plumbing, not a regression. Consistent with the sibling phase-3/4 tickets (#117–#122). - **What proves it:** `git log`/`grep` show no prior token-minting implementation to have regressed from. ## Why human The *state* is a genuine one-way door: this needs a cross-repo security-architecture routing decision that Ben must rule, and it is **not** rulable by an agent under ADR 0174 because it sits on this repo's one-way-door list on three counts: - **Credential bytes / security widening** — whatever carries the token ends up inside a *publicly downloadable installer*. Deciding the auth model (mint-time, transport, scoping) is a security-posture decision that is not provable safe by any existing test/drive/probe. - **Shared-infra tenants** — it changes `matou-infrastructure` (config-server tenant write auth), protected shared infra. - **Cross-repo routing** — it spans coa server (provisioner/kit), matou-infrastructure (tenant write auth), and matou-app (backend env plumbing); the reporter already flags it as "a routing decision before it's implementable." **Human residue for Ben:** approve (a) whether `/admin/tenants` mints a per-tenant write token, (b) the token's scope guarantee (write-own-tenant-only), and (c) that a scoped write token may ship inside a publicly downloadable installer. ## Proposed default (revise or veto) Adopt the approach the report already sketches: 1. `POST /admin/tenants` mints a **per-tenant write token scoped to write-own-tenant-only** and returns it alongside the `configUrl`. 2. `ProvisionResult` carries the token; a new field on `KitSchema` (`packages/schema`, source of truth) carries it into `kit.json`. 3. The build (`coa-builds`) reads it from the kit and sets `MATOU_CONFIG_SERVER_TOKEN` in the app's backend env/config. 4. config-server (`matou-infrastructure`) enforces the write-own-tenant-only scope server-side — the installer being public means the scope is the only real defence. **Acceptance criteria (once Ben rules the design):** - [ ] Provisioning a tenant yields a write token scoped to that tenant only; a token cannot write another tenant's `org-config.json` (server-side enforced). - [ ] The token flows provisioner → `ProvisionResult` → `KitSchema`/`kit.json` → build → app `MATOU_CONFIG_SERVER_TOKEN`. - [ ] A freshly provisioned coa app no longer emits the `MATOU_CONFIG_SERVER_TOKEN is not set` warning and successfully mirrors `org-config.json`. - [ ] Token bytes never appear in an issue, commit, or log. **Out of scope:** email-relay feature behaviour itself; feature toggles / nav order (phase 4); any tenant read-path change. **Why not delegable:** the design decision is a security-posture + shared-infra one-way door (above). Once Ben rules, the *implementation* will still need `ready-for-session` standing (config-server infra + cross-repo, per the machinery-changes convention), not a swarm worker.
Author
Owner

Ben ruled (2026-09-04): bootstrap token + AID binding.

  • /admin/tenants mints a per-tenant token and it rides kit.json → build → MATOU_CONFIG_SERVER_TOKEN, but it is bootstrap-only: the first authenticated write binds the tenant to the community's org AID (TOFU), and every subsequent write must be signed by that org identity — the bare token stops working after binding.
  • Rationale: the installer is public, so a static embedded token is effectively public; scope-only defence protects other tenants but not the community's own mirror. Binding limits exposure to the pre-setup window and reuses the org identity the app already mints at /setup.
  • Touches: matou-infrastructure (config-server: token mint at tenant create, TOFU bind, KERI signature verification on writes), coa (provisioner result + KitSchema field + kit.json), matou-app (backend signs config-server writes with the org AID), coa-builds (env plumbing).

Re-labelling ready-for-human → ready-for-session: next step is a session turning this ruling into the cross-repo ticket breakdown.

**Ben ruled (2026-09-04): bootstrap token + AID binding.** - `/admin/tenants` mints a per-tenant token and it rides `kit.json` → build → `MATOU_CONFIG_SERVER_TOKEN`, **but it is bootstrap-only**: the first authenticated write binds the tenant to the community's org AID (TOFU), and every subsequent write must be signed by that org identity — the bare token stops working after binding. - Rationale: the installer is public, so a static embedded token is effectively public; scope-only defence protects other tenants but not the community's own mirror. Binding limits exposure to the pre-setup window and reuses the org identity the app already mints at /setup. - Touches: matou-infrastructure (config-server: token mint at tenant create, TOFU bind, KERI signature verification on writes), coa (provisioner result + KitSchema field + kit.json), matou-app (backend signs config-server writes with the org AID), coa-builds (env plumbing). Re-labelling `ready-for-human` → `ready-for-session`: next step is a session turning this ruling into the cross-repo ticket breakdown.

Close report — #121 routing done: ruling recorded + broken out cross-repo

Ben ruled the design here on 2026-09-04 (bootstrap token that rides kit.json → build → MATOU_CONFIG_SERVER_TOKEN, bootstrap-only: first authenticated write TOFU-binds the tenant to the community's org AID, subsequent writes must be signed by that AID, the bare token then stops working) and relabelled ready-for-human → ready-for-session with the next step: "a session turning this ruling into the cross-repo ticket breakdown." This session did exactly that.

Landed (coa main, commit f7dd0e9):

  • ADR 0008 — docs/adr/0008-tenant-write-auth-bootstrap-token-tofu.md (status: accepted) records Ben's ruling as the canonical reference every child links to. ADR README index + STATUS log updated in the same commit.

Cross-repo breakdown filed (all ready-for-session, native dependencies wired, each references ADR 0008 + this ticket):

Repo Ticket Scope Blocked by
matou-infrastructure #12 config-server mints a per-tenant bootstrap write token at POST /admin/tenants, returns it (write-own-tenant-only, defines the 409 path) —
matou-infrastructure #13 TOFU-bind tenant to org AID on first authed write + KERI signature verification on subsequent writes (bare token then rejected) infra #12
coa #130 provisioner parses token → ProvisionResult.writeToken → optional KitSchema.configWriteToken → kit.json infra #12
coa #131 coa-builds workflow sets MATOU_CONFIG_SERVER_TOKEN in the app env from kit.json (GitHub, needs session standing) coa #130
matou-app #371 backend performs the bootstrap org-config.json write via MATOU_CONFIG_SERVER_TOKEN (kills the warning, enables email relay) infra #12, coa #131
matou-app #372 backend signs post-bootstrap writes with the org AID (survives TOFU binding) infra #13, matou-app #371

Proof: ADR 0008 is on main (f7dd0e9); the six tickets exist with the dependency graph above (verified via the tracker). No production code, no infra, no credential bytes touched — every irreversible byte (the mint, the bind, the shared-infra change, the public-installer token) lives inside the child tickets, each of which is ready-for-session and gated on its own standing.

Ruled by agent under the two-way-door doctrine (ADR 0002) — veto anytime: recording an already-made human decision as an ADR and filing a revertible ticket breakdown are two-way doors (a commit revert + closing the issues undoes them). The one-way-door decision itself was Ben's, above.

Closing #121 as the routing/design question it was — the decision is made and the implementation is filed. Follow the chain from the child tickets.

## Close report — #121 routing done: ruling recorded + broken out cross-repo Ben ruled the design here on 2026-09-04 (bootstrap token that rides `kit.json` → build → `MATOU_CONFIG_SERVER_TOKEN`, **bootstrap-only**: first authenticated write TOFU-binds the tenant to the community's org AID, subsequent writes must be signed by that AID, the bare token then stops working) and relabelled `ready-for-human` → `ready-for-session` with the next step: *"a session turning this ruling into the cross-repo ticket breakdown."* This session did exactly that. **Landed (coa `main`, commit `f7dd0e9`):** - **ADR 0008** — `docs/adr/0008-tenant-write-auth-bootstrap-token-tofu.md` (status: accepted) records Ben's ruling as the canonical reference every child links to. ADR README index + STATUS log updated in the same commit. **Cross-repo breakdown filed** (all `ready-for-session`, native dependencies wired, each references ADR 0008 + this ticket): | Repo | Ticket | Scope | Blocked by | |---|---|---|---| | matou-infrastructure | **#12** | config-server mints a per-tenant bootstrap write token at `POST /admin/tenants`, returns it (write-own-tenant-only, defines the `409` path) | — | | matou-infrastructure | **#13** | TOFU-bind tenant to org AID on first authed write + KERI signature verification on subsequent writes (bare token then rejected) | infra #12 | | coa | **#130** | provisioner parses token → `ProvisionResult.writeToken` → optional `KitSchema.configWriteToken` → `kit.json` | infra #12 | | coa | **#131** | coa-builds workflow sets `MATOU_CONFIG_SERVER_TOKEN` in the app env from `kit.json` (GitHub, needs session standing) | coa #130 | | matou-app | **#371** | backend performs the bootstrap `org-config.json` write via `MATOU_CONFIG_SERVER_TOKEN` (kills the warning, enables email relay) | infra #12, coa #131 | | matou-app | **#372** | backend signs post-bootstrap writes with the org AID (survives TOFU binding) | infra #13, matou-app #371 | **Proof:** ADR 0008 is on `main` (`f7dd0e9`); the six tickets exist with the dependency graph above (verified via the tracker). No production code, no infra, no credential bytes touched — every irreversible byte (the mint, the bind, the shared-infra change, the public-installer token) lives inside the child tickets, each of which is `ready-for-session` and gated on its own standing. **Ruled by agent under the two-way-door doctrine (ADR 0002) — veto anytime:** recording an already-made human decision as an ADR and filing a revertible ticket breakdown are two-way doors (a commit revert + closing the issues undoes them). The one-way-door decision itself was Ben's, above. Closing #121 as the routing/design question it was — the decision is made and the implementation is filed. Follow the chain from the child tickets.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/coa#121
No description provided.