Bindle v0 runtime profile
Public release and live third-party conformance remain separately gated. This document supersedes earlier discovery-only SDK and disconnected runtime descriptions. Amendments labelled "proposed (approved provisionally 2026-10-20)" below are normative proposals; their runtime work is deferred to EXT-X1, and is not claimed as implemented.
Discovery and registration
The host manifest is /.well-known/bindle/manifest.json, with version 0, exact issuer, authorization_request_endpoint, authorization_endpoint, token_endpoint, rpc_endpoint, jwks_uri, preferences_contract, and redirect presentation. Endpoint URLs belong to the issuer. Discovery is host-level, cookie-free and publicly CORS-readable. Opaque OAuth tokens need no JWT verification keys; /oauth/jwks therefore returns an empty key set and does not imply OIDC support.
This initial runtime uses operator-reviewed clients and immutable fragments. FEDERATION_CLIENTS is a JSON array of {id,name,origin,redirectUris}. Redirects are exact registered URLs on the registered origin. Names are presentation, not proof of trust. Operators must establish origin control before adding a client. FEDERATION_SCHEMAS is a JSON object keyed by fragment URL, whose values are the corresponding public documents. The registry prevents SSRF and arbitrary executable schemas; no resource or fragment URL causes ambient server fetching. Self-hosts can inject a reviewed fetch capability. Open dynamic registration is not implemented; the optional client ID metadata documents below are the only network client resolution. The registries and enabled flag are independently configurable on Workers and Node.
Client ID metadata documents (client-id-metadata.v1)
Implemented locally, off by default; not production-verified. With CLIENT_METADATA_ENABLED=true and an injected SSRF-safe egress port, the provider accepts an HTTPS URL client_id that no reviewed registration names and resolves it to an OAuth client ID metadata document (draft -02). The manifest then declares features["client-id-metadata.v1"] = {}; without the flag or the port nothing is declared and URL IDs are ordinary unregistered clients. Code: packages/federation/client-metadata.mjs (ClientDirectory).
- Precedence. A
FEDERATION_CLIENTSentry for the same ID always wins and is never fetched. Metadata clients are unreviewed. - ID syntax. Exactly
new URL(id).href:https:, default port, a non-root path without dot or encoded-dot segments or encoded slashes, no query, fragment or userinfo, at most 200 characters, and a public DNS host (no IP literal,localhost,.local,.internal,.testand similar). Comparison is simple string equality. - Fetch. One
GETwithAccept: application/json, no credentials,redirect: manual; only an exact200with media typeapplication/json, identity encoding and at most 16 KiB (declared and streamed) is read, within a 3 s deadline that aborts the request. Node uses the DNS-pinned presentation-metadata adapter (globally routable IPv4 only, pinned address, original-hostname TLS, port 443). Workers useglobal_fetch_strictly_publicplus a DoH screen of A/AAAA answers, which is screening, not connection pinning (app metadata). Concurrent lookups of one ID share a request (at most 16 in flight). - Budgets before egress. Each fetch first consumes
client-metadata/global(120/min) andclient-metadata/site/<last two host labels>(6/min; no public-suffix list, so grouping is coarse and only tightens budgets) from the fleet-wide ABUSE limiter (Workers objects; Node SQLite guards). Unauthenticated entry creation for a metadata client also charges the caller's existing per-address and per-client budgets and a per-client-site budget (300 per 10-minute window, on the shard named by the site) before resolution. When budgets refuse a refetch, a previously validated document is served for at most one hour past its freshness. The provider's own issuer and embed hosts and their subdomains are never accepted as client hosts. - Validation.
client_idequals the URL;redirect_urisis 1–16 distinct exact canonical HTTPS URLs without fragment or userinfo, all on theclient_idorigin;token_endpoint_auth_methodis absent ornone;client_secret,client_secret_expires_at,jwksandjwks_uriare refused;grant_types⊆ {authorization_code,refresh_token} and includes the code grant;response_types⊆ {code}.client_name(≤100 code points, no control, soft-hyphen, zero-width, separator, bidi, variation-selector, interlinear or tag code points),client_uriandlogo_uri(same origin only) are optional presentation; invalid presentation is dropped, never fatal. Logos are not fetched or rendered. - AMD-C7 — proposed (approved provisionally 2026-10-20). When declaring
integrations.v1, a provider MUST accept otherwise-valid client metadata withtoken_endpoint_auth_method: "private_key_jwt"andjwks_urion theclient_idorigin and path prefix (through its last/), under integrations §2. This is the explicit exception to the public-client-only validation above; withoutintegrations.v1, such documents MUST be refused. Key fetching, validation and approval snapshots follow integrations §2.3; inline keys and client secrets remain refused. - Cache. In-process, at most 512 IDs, keyed by the exact requested ID: a validated document for
max-ageclamped to 5 min–24 h (default 1 h;no-store/no-cache→ 5 min). Failures are remembered for 60 s as failures only, never as documents (the draft forbids caching error responses as documents; this short negative entry only throttles refetching). Limitation: the Node egress adapter does not passCache-Controlthrough, so Node caches every document for the 1 h default. A flood of distinct IDs can evict cached entries (512-entry LRU); evicted clients refetch within their budgets. - Snapshots. The resolving front (routing authority or entry facade) passes a validated snapshot
{id,name:<host>,origin,redirectUris,reviewed:false,claimedName?,clientUri?,logoUri?}to the owner shard as a separate trusted argument; request bodies cannot carry one. The pending request holds it; only the owner's approval persists it in that owner's store (at most 128 unreviewed clients per owner), so code exchange, refresh and RPC never refetch. The feature flag also gates loading snapshots: disabling it stops metadata clients' tokens. - Presentation. Consent, entry and grant surfaces label the app by its verified host;
claimedNameappears only as "Name the app gives itself (not verified)" with bidi isolation, beside a notice that the provider has not reviewed the app. Unreviewed clients cannot use embedded (island) delivery, because the embed shell serves reviewed clients only. - CORS. A metadata client's allowed origin is its
client_idorigin, derived without fetching. Preflights to the entry, request, token, revocation and RPC endpoints are answered for any HTTPS origin while the feature is on; the actual request is then checked against the named client or the token's client. - Blocking. Administrators block a client host (
POST /api/admin/clients/block{host,blocked,reason?}, auditedclient.block/client.unblock;POST /api/admin/clients/blockslists). A block covers the host and all its subdomains. A blocked host's URL clients cannot be resolved, start entries or authorization requests, exchange codes, refresh, or make cross-origin calls; a live five-minute access token used without an Origin expires on its own. Decisions are cached for 30 s per process; an unreadable block list fails closed, and the Worker keeps the feature off when the admin authority binding is absent. Reviewed static clients are configuration and are not affected.
Fragment bytes are validated against the bounded declarative field subset and pinned using SHA-256 over canonical() JSON: recursively sorted object keys using JavaScript string ordering, array order preserved, scalar JSON.stringify, UTF-8 bytes, unpadded Base64url digest. No executable properties, external references or UI HTML are accepted. A URL whose digest changes is rejected; publish a new URL for a new version.
HTTP flow
- An app discovers the selected provider.
BindleClient.beginLogin(handle,{requests})generates a random state and PKCE verifier, derives S256 and POSTs/api/oauth/requestswith{identity,clientId,redirectUri,challenge,challengeMethod:'S256',state,requests}. Requests are{fragment,required,purpose,fields,methods?}in the implemented baseline. AMD-C2 — proposed (approved provisionally 2026-10-20): requests MAY additionally carrydigest(sha256-plus the canonical JSON SHA-256 digest in unpadded base64url); the provider MUST reject a mismatch with its pin or fetched document. Methods are{field:{contractURL:[method]}}. At most eight fragments are requested; an empty list is an identity-only connection. - The provider resolves the explicit handle to an active identity and returns
{requestId,view}. The SDK redirects to/oauth/authorize?request_id=.... Requests last ten minutes. Targeted authorization reveals identity availability and a public UUID locator; it is not an enumeration-proof lookup. Public discovery does not reveal individual existence. IP/subnet/service admission limits bound lookup and request creation. - The provider page loads its actual session and request. An anonymous view has public request metadata only. Signing in preserves only a validated, expiring same-provider authorization continuation; it creates no grant. Only the target account can approve the request.
- Users configure missing fragments, choose optional fragments, inspect every shared value, choose resources/methods and review affected apps. POST
/api/preferencesis owner-session/Origin/CSRF protected. Scalar edits propagate to approved consumers; additions, resource scope changes, removal/restoration and generation changes require fresh resource consent. Optional decline survives configuration of another fragment. - POST
/api/oauth/requests/:id/decisionaccepts{requestId,approved:[{fragment,revision,fields,resources,methods}]}or{requestId,denied:true}. Cancel needs no configured values. Approval checks the current revision, owner authority epoch and app connection generation. It redirects only to the exact registered callback with code/state/iss or access_denied/state/iss. Codes last sixty seconds and are consumed atomically once. - POST
/oauth/tokensupports standard form fieldsgrant_type=authorization_code,code,code_verifier,client_id,redirect_uri. It returns{access_token,token_type:'Bearer',expires_in:300,issuer,subject,client_id,audience,grants,granted_fragments}. The SDK verifies exact callback, state, issuer, client, audience, subject and token metadata, clears the callback query and pending verifier, and keeps the bearer in memory. The native profile additionally returnsrefresh_tokenandrefresh_expires_in, with an absolute eight-hour lifetime. The SDK retains both access and renewal credentials only in memory. It rotates the renewal credential before access expiry; reloading loses the session and starts a fresh login. Providers advertise supported grants ingrant_types_supported. - POST
/bindle/rpcuses Authorization Bearer plus{version:'0',tx:UUID,resource,contract,method,args}.@preferenceswith the preferences contract'sread({fragment})returns only granted fields. Resource-valued fields yield{id,contracts,token}. The opaque reference hides the backing resource URL and private scope, remains stable across consumers and renewal, and resolves relative logical keys. Each resource token is independently attenuated to its field, resource, scope, generation and live method grants; it cannot read sibling resources or scalar preferences. The SDK'scallResourceuses that token rather than the app's broader bearer.
AMD-C5 — proposed (approved provisionally 2026-10-20). The token response and client grant listing MUST report per-requested-fragment outcomes through fragment_outcomes, a map from exact fragment URL to granted, declined, unsupported or unavailable. A missing outcome MUST be interpreted as declined, never as granted. granted_fragments continues to carry only granted fragment details. Outcomes do not confer authority; unsupported and unavailable follow the public-fact rules in extensions §5.2, without revealing private occupancy.
CORS permits only registered app origins for request/token/RPC endpoints, and public manifest/JWKS reads. Owner methods never use app-origin CORS or bearer authority. Unknown/expired tokens fail closed. Header/body/origin/JSON byte bounds apply before processing; RPC envelopes/results are bounded to 1,500,000 bytes. Configured storage currently supports at most 1 MiB per object; that is an implementation limit, not a storage plan size. Actual provider capability and conformance limits are independently documented.
Authority, scoping and revocation
The controller authenticates through the real IdentityService and sharded identity repository. Account authority is a digest of permanent assignment and current recovery authority. Exchange and every RPC check current account status and authority epoch. Account recovery, suspension or deletion invalidates existing access. App connections are ordinary managed resources with transport bindle; disconnect changes generation and invalidates parent and child tokens. GET /api/grants lists owner grants; DELETE /api/grants/:id revokes one fragment grant with Origin/CSRF checks.
A resource assignment is a URI or {resource:URI,scope:{prefix?,readOnly?,maxObjectBytes?}}. Scope support comes from the optional resource-scoping contract; unsupported options fail closed. Storage prefix means the selected key and slash-delimited descendants, rather than a raw textual prefix. Read-only denies write/delete/write-presigning. Byte limits bound object reads/uploads. Presigning preserves these restrictions through signed proxy URLs when a native backend cannot enforce them. Presign also requires the corresponding get/put permission on the same field; each URL authorizes only its requested read or write operation. Prefix-constrained URLs remain opaque. Native URLs are used only where size/version/other bounds can be enforced, disclose the backing address and have expiry-only revocation; proxy URLs recheck current authority. See storage contract for exact arguments and headers. Ranged reads under a byte limit remain disabled for external connectors until full object size can be verified; hosted storage verifies the full size. Scope belongs to the shared preference field and applies to every consumer. Apps cannot edit it. The owner editor at /preferences reviews old/new values and the exact live assigned subscriptions, then performs a single explicit shared save using expectedRevision, reviewedConsumerDigest and updateShared:true. Consumer/grant/assignment changes invalidate that review. Existing field/method ceilings are preserved; revoked, disconnected or removed subscriptions cannot revive. A subscription can remain reviewable when a temporary shared restriction disables all its previously approved methods; the owner can explicitly restore those methods within their existing ceiling. Without the explicit shared review, changed/removed/restored assignments permanently narrow old resource grants. Old child references/tokens stop working on every assignment change; apps reread the fragment for the replacement reference.
Native resource descriptors are refreshed from actual owned, connected resources before review and dispatch. Their generations are snapshotted in grants. Reconnecting a provider never silently restores old access. The native Account effect boundary checks identity epoch, app connection, resource generation and scope before replay or effects. Grant revocation prevents subsequent admissions; an operation admitted before revocation can finish. Remote effects and grant metadata are not one distributed transaction, and no stronger guarantee is claimed.
AMD-C3 — proposed (approved provisionally 2026-10-20). Preferences reads MUST project approved resources in owner order, omit unapproved resources and add their field to requiresConsent; an unapproved addition MUST NOT withhold approved resources. AMD-C8/C9 — proposed (approved provisionally 2026-10-20): brokered resources are projected only through preferences v2; v1 omits them and reports the field in requiresConsent. Only brokered-resources.v1 permits direct integration RPC, with its endpoint/audience and revocation rules; the native gateway behavior above is unchanged.
Persistence and scaling
Federation state is independent per stable account UUID, in a FederationObject on Workers and a private SQLite database on Node. Opaque locators have UUID.random256bit form; the UUID locates state but grants no authority. Missing/inactive UUIDs are rejected before allocating federation state. Code and token records are keyed by domain-separated hashes, never plaintext credentials. Owner preferences and grants do not require global scans or a global lock.
Per-account bounds are 32 pending requests, 64 codes, 256 bearer records and 256 live grants. Expired requests/codes/tokens and revoked grants are pruned during bounded admission; retained mutations are bounded to 256 outcomes for twenty-four hours per account. Resource tokens are deterministic derivations of the parent secret plus exact attenuation and a private random field incarnation, stored by hash and never outlive their parent. Opaque reference IDs are derived independently of the parent bearer from that private incarnation, so a consumer cannot guess hidden prefixes offline and all consumers see the same scoped resource identity. Incarnations rotate on assignment changes and are never returned to apps. At most 32 live renewal families and 128 retained rotation hashes per family are permitted. Consumed hashes stay until absolute expiry or family retirement; replay revokes the family and all its access/child tokens. Wrong-client or arbitrary-token attempts cannot revoke another family. Renewal intersects only the original still-live grants, never newly approved ones. Recovery/disconnect/revoked families are reclaimed at admission, and account-local alarms prune expired ephemeral state in bounded batches. Node uses the same cleanup policy and private timers. Do not imply unlimited background automation throughput from these limits.
Mutations durably reserve a journal entry before native/provider effects. Fingerprints bind resource, contract, method, args, account epoch, connection/resource generation and scope. Repeated writes return the recorded result only after current authorization; collisions fail. Unknown outcomes remain indeterminate and require reconciliation by fresh reads. Local transactional adapters retain a short transaction; remote account/provider dispatch executes outside the federation metadata transaction to avoid lock cycles and false distributed atomicity.
SDK session behavior
Email absence detection is implemented, but magic-link account materialization and delivery are separately gated; the SDK does not silently create accounts or attach email.
The SDK coalesces concurrent renewal into one request. Aborting one caller does not replay a spent secret or cancel other waiters. Sign-out/new login prevents late credentials from restoring a session. Tracked resource references are reacquired by the exact same opaque ID after renewal; a changed assignment fails rather than substituting another resource. Uncertain renewal outcomes require a new login. Mutating RPCs are never retried merely because a network response was lost.