5 Facts About Macaroons: The Cookies That Carry Rules

Macaroons explained in plain terms means understanding the bearer tokens that carry their own rules, credentials from a 2014 paper that let the holder narrow what a token can do without ever asking the issuer. The central question is why a token needs rules inside it when a server could just check a database, and the answer is that a server check needs a round trip and a central list, so a token that enforces its own limits works anywhere, even offline.

Macaroons are flexible authorisation credentials for cloud services that support decentralised delegation between principals. They are built from nested, chained message authentication codes, which means each new rule is folded into the signature, and because the chain only ever gets longer, a token can be weakened by anyone holding it but never strengthened.

This article sets out five facts about macaroons, what they are, how they work, and where they run in the real world.

Key takeaways

  • Macaroons are bearer tokens with embedded caveats.
  • Birgisson and colleagues introduced them in 2014.
  • They are built from chained HMACs.
  • Anyone can add caveats, nobody can remove them.
  • Third-party caveats need a discharge from another service.

What macaroons are

Macaroons are tokens that turn a secret into a delegatable permission, and that delegation is what makes them unusual among credentials. Each macaroon starts as a root identifier signed with a secret key, which means the holder can pass it on, and because every caveat added along the way narrows it further, the token that reaches the end is weaker than the one that started.

Their signature feature is the caveat. Most bearer tokens are all or nothing, but a macaroon carries predicates that limit when, where and for what it works, which means a token can say read only, only this file, only before Friday, and because the caveats are part of the signed chain, they cannot be peeled off.

The idea was a reaction to the limits of cookies. Web cookies carry pure bearer authority with no way to limit it, so Birgisson, Politz, Erlingsson and their colleagues asked whether a cookie could carry its own restrictions, because a token that cannot be narrowed is a token that must be trusted completely, and that practicality is what made macaroons worth defining.

They became one of the best-known credential designs in the world, and they are named in every discussion of the field. The paper appeared at the Network and Distributed System Security Symposium in 2014, macaroons are used in production systems like Fly.io, and they are still the first example engineers meet when they learn that a token can attenuate itself, which means the design survives as a standard even though it is a decade old.

Our guide to Fernet explains the other sealed-token format macaroons are measured against, and our guide to PASETO explains the versioned token format that takes a different approach to safety.

How macaroons work

Everything starts with the root, which sets the authority. The issuer signs a root identifier with a secret key, which means the first signature is the whole credential, and because everything after it chains from that signature, the root key is the only secret in the system.

Each step begins with a caveat, which narrows the token. The holder adds a predicate like only read access and folds it into the signature with a keyed hash, which means the new signature depends on the old one plus the caveat, and because the hash chain is one-way, the caveat cannot be removed without the root key.

Chained HMACs are what make the design work as a whole. Each caveat is hashed together with the previous signature to make the next one, which means the token carries its whole history in its final signature, and because the verifier can replay the chain, it can check every caveat from the root key alone.

Verification spreads the effect further. The verifier replays the chain from the root key, checks each signature and tests each caveat against the request, which means a token used outside its limits is rejected, and because the check needs only the root key, it works without any database lookup.

Third-party caveats are what turn the token into a distributed credential. A caveat can say this token works only with a discharge from another service, which means the token holder must fetch a second proof from that service, and because the discharge is itself a macaroon, the pattern can nest as deeply as needed.

The result comes from the verification, read out as allowed or denied. Macaroons either satisfy every caveat or fail outright, which means the result is a clear decision whatever the request, and that clarity is exactly what an authorisation check needs.

A dark office with a developer sharing access tokens on a laptop, a notebook and a coffee cup on the desk
A dark office with a developer sharing access tokens on a laptop, a notebook and a coffee cup on the desk, shows how macaroons work: caveats take turns narrowing a token, step after step, until only the allowed access remains.

Comparing macaroons with other credentials

Macaroons are one of several ways to carry authorisation, and each was built with a different emphasis. Cookies are the simple bearer tokens built for the web, JSON Web Tokens are the structured tokens built for APIs, and macaroons are the ones built to be narrowed offline, while each approach trades something for something else.

The table below sets out the main contrasts between the leading approaches.

Aspect Macaroons Cookies JWT
Carries rules Yes, caveats No Claims, but fixed
Can be narrowed Yes, by any holder No No
Needs a server check No Usually No
Revocation Hard, needs expiry Delete the cookie Hard, needs a list
Best for Delegated access Web sessions API tokens

The practical result is that macaroons are the right choice for delegated access, cookies suit web sessions, and JWT fits API tokens instead.

Where macaroons are used

Cloud platforms use them for delegated access. Fly.io issues macaroons that let one service act for another with limited rights, because a worker should be able to write secrets but not read them, and that split is the reason macaroons earn their keep in production.

Storage services use them for sharing. A user can hand a friend a macaroon that allows reading one file until Friday, because sharing should not need the owner to stay online, and that independence is the reason the design was built for real sharing.

Microservices use them to limit blast radius. Each service holds a macaroon narrowed to exactly what it needs, because a compromised service should not inherit the whole system, and that containment is the reason macaroons appear in service meshes far beyond their paper origins.

Benchmarking uses them as the attenuation reference. Engineers still quote macaroons when they discuss how credentials should be delegatable, because they are the clearest example of weakening without a server, and that number shapes how new credential systems are measured.

Teaching uses them as the caveat example. Courses introduce macaroons when they explain that a token can carry its own policy, because they are the clearest case of a credential that gets safer as it is passed on, and a student who understands macaroons understands why bearer tokens need not be all or nothing.

Strengths and limits

The greatest strength of macaroons is offline attenuation. A holder can narrow a token without contacting the issuer, and that strength is real, measured in the production systems that rely on it and confirmed by the years the design has survived.

It is also a strength that verification is cheap. A verifier needs only the root key and a few hashes, and that speed is worth more than cleverness in a field where an authorisation check that needs a database is a check that fails when the database does.

The limits are real, though, and the biggest is revocation. A macaroon cannot easily be cancelled before it expires, which means a leaked token stays valid until its caveats run out, and a system that needs instant revocation must add short expiries or a block list.

Macaroons checklist

  • Use macaroons for delegated access, never as a session cookie.
  • Remember Birgisson and colleagues introduced them in 2014.
  • Note caveats can be added but never removed.
  • Compare them with JWT to see narrowing versus fixed claims.
  • Study the HMAC chain, which is what makes the token work.
  • Check the expiry caveat, since revocation is hard.
  • Keep the root key secret, since it can mint any token.
  • Read the 2014 paper to see how the design was set.
  • Choose macaroons when tokens must be safely handed down.

Frequently asked questions

What is a macaroon in simple terms?

It is a token that carries its own rules, so whoever holds it can narrow what it allows but never widen it.

Who created macaroons?

Arnar Birgisson, Joe Gibbs Politz, Ulfar Erlingsson and colleagues, who published the design at NDSS in 2014.

How are macaroons different from JWTs?

Both carry claims, but a macaroon can be narrowed by any holder while a JWT is fixed once it is issued.

Are macaroons still secure?

They are widely used in production, but they are hard to revoke, so short expiries are the usual answer.

Where are macaroons used?

In cloud platforms, in file sharing, in microservices, and in teaching about authorisation.

When should I use macaroons?

When you delegate limited access, when you share files offline, or when you study credential design.

The bottom line

Macaroons explained in one line is this: a cookie that can say no, a 2014 design that chained HMACs into narrowing tokens and taught the field that a credential should get weaker as it travels, not stronger.

It is proof that a token can carry its own policy, and the reason it still matters is that every delegatable credential designed since has been judged partly by the lesson macaroons taught.

This article is general information about how macaroons work, not advice about choosing encryption for a particular device or system.

Latest articles

Scroll to Top