caelum0x b50ea5694f fix(vend): self-serve end-user wallet provisioning trusted an unverified mint_account_id
POST /v1/customer/apps/:app_id/end-users let any self-serve tenant admin bind
an arbitrary, unverified mint_account_id to their own app's end-user. Since
end_user_reserve funding opens every metered-request hold against that exact
account (vend_tenancy::funding_account_id -> run_flow), a tenant who merely
*knew* another account's id (never created it, never controlled it) could
attribute their own app's billing to that account — a cross-tenant fund-
custody gap, not merely a cosmetic one. Proven live against real Postgres
(crates/vend-store/tests/cross_tenant_wallet_binding.rs): an unrelated
tenant B binds tenant A's real wallet as its own end-user, then resolve() +
funding_account_id() (the exact functions run_flow calls) hand back A's
account as B's funding source.

Fix: added MintTransport::get_account (GET /v1/accounts/:id) and a new
verify_customer_owns_mint_account gate in the customer-facing handler only —
it checks the account's Mint-recorded owner_ref against the exact
`vend:{app_id}:{external_ref}` convention ensure_wallet already writes on
real wallet creation, now shared via vend_core::whitelabel::wallet_owner_ref.
The operator-only /v1/control/.../end-users route is intentionally untouched
— the README already documents hand-mapping an existing account as a
trusted-operator capability. Proven closed by a FakeMint-backed unit test in
vend-server (control::tests) covering cross-tenant, wrong-ref, orphan-
account, and the still-working legitimate case.

cargo build/test/clippy clean across the vend workspace; the 7 pre-existing
clippy findings are unchanged from main (verified via git stash).
2026-11-05 23:44:41 +03:00
..
…