kit/provision: coa apps have no MATOU_CONFIG_SERVER_TOKEN — org config never mirrors to the tenant #121
Labels
No labels
agent-blocked
agent-working
bug
deferred
enhancement
model-haiku
model-opus
model-sonnet
needs-info
needs-triage
no-triage
priority
product-decision
ready-for-agent
ready-for-human
ready-for-session
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
Reference
Matou/coa#121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Seen on the first real ngati-example v0.6.3 launch (2026-09-04): the backend warns
The app fetched its client config from the tenant fine (
coa-infra.matou.nz/ngati-example), but it has no write token, soorg-config.jsonwill 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/tenantstime 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.
Triage — #121
Verification (against the codebase, 2026-09-04):
httpProvisioner.provision()callsPOST /admin/tenantsand returns only a readconfigUrl— 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.MATOU_CONFIG_SERVER_TOKEN,config-server-token,write.token,tenant … token, and any minting logic acrossserver/srcandpackages. 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.jsonnever mirrors to the tenant and email relay cannot work.Category ruling — enhancement
Ruled by agent under ADR 0174 — veto anytime.
enhancement(notbug).git log/grepshow 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:
matou-infrastructure(config-server tenant write auth), protected shared infra.Human residue for Ben: approve (a) whether
/admin/tenantsmints 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:
POST /admin/tenantsmints a per-tenant write token scoped to write-own-tenant-only and returns it alongside theconfigUrl.ProvisionResultcarries the token; a new field onKitSchema(packages/schema, source of truth) carries it intokit.json.coa-builds) reads it from the kit and setsMATOU_CONFIG_SERVER_TOKENin the app's backend env/config.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):
org-config.json(server-side enforced).ProvisionResult→KitSchema/kit.json→ build → appMATOU_CONFIG_SERVER_TOKEN.MATOU_CONFIG_SERVER_TOKEN is not setwarning and successfully mirrorsorg-config.json.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-sessionstanding (config-server infra + cross-repo, per the machinery-changes convention), not a swarm worker.Ben ruled (2026-09-04): bootstrap token + AID binding.
/admin/tenantsmints a per-tenant token and it rideskit.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.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 relabelledready-for-human→ready-for-sessionwith the next step: "a session turning this ruling into the cross-repo ticket breakdown." This session did exactly that.Landed (coa
main, commitf7dd0e9):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):POST /admin/tenants, returns it (write-own-tenant-only, defines the409path)ProvisionResult.writeToken→ optionalKitSchema.configWriteToken→kit.jsonMATOU_CONFIG_SERVER_TOKENin the app env fromkit.json(GitHub, needs session standing)org-config.jsonwrite viaMATOU_CONFIG_SERVER_TOKEN(kills the warning, enables email relay)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 isready-for-sessionand 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.