Fly.ioExplainer
Macaroons Escalated Quickly
Summary
Fly.io built a Macaroons-based security token system after finding its API tokens too powerful for expressing scoped permissions and roles. The design starts with a user-linked, HMAC-signed bearer token and chains caveats through HMAC, while checking every caveat independently so each added restriction can only weaken authorization. It models organizations, apps, machines, and volumes with first-party caveats, and also includes third-party caveats, service-token transformations, machine locking, nonce-based revocation, and expiration handling across customer workloads. The resulting system lets users create roles without changing the platform and supports SSO, plugins, and traceable inter-service authorization, although the author acknowledges extra complexity and awkward ways to express some roles.
Context
Fly.io found that its API tokens were too powerful and needed a way to scope them down and express roles. The project was scoped to replace OAuth2 tokens and support varied permission requirements on a public cloud platform.
Approach / What changed
The system uses user-linked HMAC-signed bearer tokens with chained caveats. Users can add restrictive caveats, while the implementation also provides first-party and third-party caveats, service-token transformations, machine locking, organization-specific SSO, and nonce-based revocation.
Takeaways
Each caveat is checked independently, and every added caveat can only weaken a token’s authorization; a token with no caveats is unrestricted and should not be honored.
Fly.io models permissions through caveats covering organizations, apps, machines, and volumes, allowing users to create administrator, auditor, deployment, and other roles without platform changes.
The implementation supports service tokens for longer-lived distributed workflows, machine-specific attenuation, nonce-based revocation, SSO, plugins, and traceable inter-service authorization, but restrictive caveats can express some roles awkwardly.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.