Blob broker protocol v1
Status: normative for thebroker blob store. Where this document and the
Formation client disagree, this document wins and the client is the bug.
A blob broker lets an install keep objects in a store it holds no credential
for. The install asks the broker for a short-lived signed address for one
object and one operation, then moves the bytes directly to or from the store
behind that address. The bytes never pass through the broker.
This contract is independent of any hosting operator, control plane or storage
vendor. An operator who would rather hand an install a bucket and a key pair
configures the S3 blob store
instead; an install has one or the other.
Two roles are used below. The client is Formation’s broker blob store.
The broker is the service this document specifies.
Trust model
The client is untrusted. The broker authenticates each request by its credential and derives the caller’s scope, which install it is and where that install’s objects live, from the credential’s server-side meaning. Nothing a client sends can change that scope. A key names an object within the caller’s scope and never outside it: the broker mapskey into the scope itself, and no
key reaches another install’s objects.
The store’s own credential stays with the broker. A signed address is the only
authority a client ever holds over the store, and it is authority for one
operation on one object for a short time.
The broker authorizes nothing about who may read an object within an install.
That decision is the install’s, made in its own database before it asks.
Transport
The configured endpoint is anhttps URL without credentials, query or
fragment. It may carry a path prefix; every path below is relative to it and
begins with the version, /v1. A breaking change ships as /v2. /v1 adds
only optional response fields and new error codes, which clients tolerate.
Requests carry Authorization: Bearer <token>. The token is opaque to the
client, which sends it to the broker and nowhere else: never to a signed
address, a log line or an error. Request and response bodies are JSON.
Responses use Cache-Control: no-store. A 3xx is an error; a client never
follows a redirect from the broker or from a signed address.
Sign a request
POST /v1/objects/sign
A success is
200 with:
put a body of exactly size bytes. It adds no credential.
Any other status from the store is a failure of that operation.
What the client refuses
The client checks an answer before using it and treats any of these as a failure, making no further request: a body that is not the object above or is larger than 64 KiB; aurl that is not https, has no host, or carries
credentials or a fragment; a method other than the one the operation calls
for; a header named Authorization, Cookie, Proxy-Authorization, Host,
Content-Length or Transfer-Encoding; more than 16 headers; and an answer
that contains the client’s own token.
Errors
A refusal is a non-200 status with:
code is lowercase letters, digits and underscores, at most 64 characters.
Clients branch on code and status only. message is for an operator reading
the broker’s side; the client does not repeat it. A body that is not this
envelope is still a refusal, keyed by its status.
Broker obligations
- Confine every signed address to the caller’s scope, and to the one object and one method requested.
- Keep signed addresses short-lived. Five minutes is ample for one object.
- For
put, bind the address to the declaredsizewhere the store can, so a client cannot store more than it declared. - Never return the store’s credential, and never accept a client’s choice of bucket, prefix or scope.
- Refuse a credential whose install has been stopped or removed.
- Decide the fate of an install’s objects when the install is removed. The client deletes objects one at a time as its own records are deleted and never lists or sweeps.
Configuration
FORMATION_BLOB_BROKER_URL is the endpoint and FORMATION_BLOB_BROKER_TOKEN
the credential. Set both or neither; one without the other fails startup, as
does setting them together with FORMATION_BLOB_S3_*. A complete pair that
cannot be used (a non-https endpoint, a malformed token) is logged at startup
and the install serves without a blob store. The broker is not contacted at
startup; a wrong token or an unreachable broker shows as objects that are not
kept.