carlos / platform Public

Instance identity a hub app can verify (signed per-instance assertion) Feature Request open

Problem

Apps that run one instance per tenant almost always grow a "hub" app beside it: the place that signs people in once, holds shared data and secrets, proxies a rate-limited third-party API, and gathers reports. Every app on our machines that does this hand-rolls the trust between hub and instances:

  • comercio: main pins a per-shop public key and POSTs a signed assertion through the browser.
  • ppl: a stateless hub signs a cookie; each instance verifies with the hub's public key.
  • Tito Go: the router signs X-Tito-Auth-* headers; instances check TITO_AUTH_PUBKEY. The relay proxies Stripe, PayPal and SES for every instance.
  • Eleven: instances call push, fetch and the meter with per-instance bearer tokens set by hand.

The missing half is the other direction: an instance proving to its hub which instance it is. Today the only platform credential an instance can hold, CARLOS_INSTANCE_TOKEN, is app-wide (#155), and #155 half 1's instance-bound token only reaches the platform's own doors.

Proposal

A platform-signed instance identity any app can verify without calling the console:

  • Each instance gets a short-lived signed assertion (a JWT, say), or can fetch one over its socket: {account, app, host, instance id, region, exp}.
  • The deployment publishes its verification keys at a well-known URL (JWKS).
  • A hub verifies the assertion on each call and knows exactly which tenant is asking: per-tenant rate limits on a shared API proxy, per-tenant reads of shared data, per-tenant report pushes. No secrets to copy into each instance's config, nothing to rotate by hand.

The reverse direction (hub to instance) can reuse it: the hub's own assertion names a different app in the same account, and an instance can be told which hub app to trust.

Needs #990 too (a hub and its instances on the same box cannot reach each other through the edge today).

Related: #155, #449, #185, #852 (identity gate for people), #514, #303.