A function's platform token is its application's service account
Status
Section titled “Status”Accepted and built (platform control endpoint, ABI operation, Go runner and JVM host support). The decision to switch any particular function over to it is left to the operator.
2026-11-04.
Context
Section titled “Context”First-party functions often call other first-party applications that accept platform tokens. Before this decision each such function kept its own client id and secret for the target, fetched its own token and cached it. That meant a secret per function, stored and rotated by hand, and no common audit.
Decision
Section titled “Decision”A function can declare platformToken: true in its describe document, and then ask its host for an access token. The function holds no credentials.
- Identity. The token is for the service account linked to the function’s application. Always that one: there is no per-function service account and no override. The function’s optional webhook-verifier account is not used for this.
- Declaration. Use without the declaration is refused by the host (
NOT_DECLARED) and again by the platform (PLATFORM_TOKEN_NOT_DECLARED, 403). - Mint. The host calls
POST /control/functions/tokenwith the function id and version. The caller must be an anchor-tier principal allowed to control function runners. The platform checks the function and version exist, the version declares the capability, the application has a linked service account (otherwise 409APPLICATION_SERVICE_ACCOUNT_REQUIRED) and the account is active. The token is exactly what that account’sclient_credentialsgrant would give: same claims, scope and lifetime. - Authority. The mint does not apply the “within the caller’s own permissions” check used for administrator token minting. The caller is a runner, whose authority is the runner role plus the function’s declaration; runners already receive every function’s secrets.
- Audit. Every mint is recorded (operation
TOKEN_MINTED_FOR_FUNCTION, entity the service account, principal the runner). The token is never logged anywhere. - Guest operation. ABI operation 15 (
platform.token) returns the token and its expiry in milliseconds.refresh: truebypasses the cache, for a target that answered 401 after the account’s roles changed. A runner that predates the operation answersUNKNOWN_OP, which SDKs surface as a clear “not supported” error. - Caching. The host caches one token per function, serves it while more than the larger of 60 seconds or 10 per cent of its lifetime remains, shares one fetch among concurrent callers, drops the entry when the function leaves desired state, and never caches a failure.
Consequences
Section titled “Consequences”Good:
- No per-function secrets for calling first-party applications; rotation happens on one account.
- Every use is attributable and the permission set is the application’s, which operators already manage.
- The same behaviour on every runner kind, because the contract is an ABI operation plus one control route.
Bad:
- All functions of an application share one identity, so one function’s token carries the permissions the others need. Least privilege is per application, not per function.
- Scope cannot be narrowed per target or audience yet.
- Runners are trusted: a compromised runner can mint tokens for any function that declares the capability.
- An application with no linked service account cannot use it.
Alternatives considered
Section titled “Alternatives considered”| Alternative | Why not |
|---|---|
| A service account per function | Many more identities to create and permission; the application is already the unit of ownership. |
| Per-function override of the account | Opens the door to functions reaching beyond their application. |
| Keep per-function client credentials as secrets | Works, but duplicates secret handling and audit in every function. |
| Narrow the token per target | Useful, but not built; left for later. |