caelum0x 26c3038ea8 fix(tenant-registry): require an operator credential on inbound RPCs — CreateTenant/ListTenants were reachable with zero auth
tenant-registry's own gRPC server (CreateTenant/GetTenant/ListTenants)
had no inbound auth check at all, unlike gateway's internal/tenantauth
and ledger-core's src/tenantauth.rs. Since it mints and attaches its
own pre-provisioned operator JWT to every ledger-core call it forwards
regardless of caller identity, ANY network caller to its gRPC port
(published 0.0.0.0:7011 in docker-compose.yml) could onboard unlimited
platform tenants or list every tenant's name/currency/reserve-floor
with no credential whatsoever — a real, newly-live gap since round 9
wired `ration tenant create/list` to this exact RPC surface.

Adds services/tenant-registry/internal/operatorauth (mirrors gateway's
tenantauth credential handling, simplified for the operator-only case),
gated by RATION_TENANT_REGISTRY_REQUIRE_OPERATOR_AUTH (true by
default). `ration tenant create`/`list` now mint and attach their own
operator credential, same pattern the CLI's other commands already use
for gateway/ledger-core.

Verified live against the real bare-metal stack: a throwaway gRPC
client with no credential gets Unauthenticated, a garbage bearer token
gets Unauthenticated, a valid but non-operator (tenant-scoped) API key
gets PermissionDenied, and the real `ration tenant create`/`list`
commands succeed end-to-end with their own minted operator credential.
go build/vet/test clean across tenant-registry and cli, 0 regressions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-29 10:54:39 +03:00
..