TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Macaroons Escalated Quickly

263 点作者 mkeeter超过 1 年前

27 条评论

tptacek超过 1 年前
Back in 2021, when I wrote the API token survey post, I had some, uh, caveats about Macaroons, and linked to a talk from a developer at Chain who had gone through the experience of deploying them. Don&#x27;t get me wrong, it&#x27;s still an excellent talk†, but after working on implementing them for a year or two I find it much less damning than I did at the time.<p>One problem Chain seemed to run into was coupling between their services. They had a fast Golang &quot;ledger&quot; and a slow Rails &quot;dashboard&quot;, and found that Macaroons forced all their requests to loop through the &quot;dashboard&quot;. This was because they&#x27;d opted to do short-lived Macaroon tokens that needed to be reissued every 5 minutes (eminently sane), and only their dashboard could generate the proper token?<p>Another problem they had with Macaroons: their Rails dashboard has an RBAC permissons interface. But once they&#x27;ve issued a Macaroon, users can&#x27;t change permissions with the interface anymore. But that&#x27;s a problem with all stateless tokens, not just Macaroons; in fact, Macaroons probably help here, because if you&#x27;re presenting a Macaroon to the dashboard interface in the first place, the RBAC interface can just attenuate it for you and hand it back to you.<p>I still think this is a design that mostly makes sense only if you have a problem domain for which both attenuation and delegation make sense. Most basic CRUD apps don&#x27;t have these problems, and using Macaroons would be a mistake for them.<p>† <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=MZFv62qz8RU" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=MZFv62qz8RU</a>
评论 #39210764 未加载
评论 #39207538 未加载
评论 #39207604 未加载
评论 #39220346 未加载
windlep超过 1 年前
I remember when I saw a presentation by the macaroon authors a few years back, there were pending patents that Google filed around them. While the authors claimed Google wouldn&#x27;t sue anyone, I&#x27;m always a bit skeptical about such claims. I thought macaroons would be helpful for some of my use-cases, but since I now knew there were patents that&#x27;d be wilful infringement so I didn&#x27;t bother.<p>I can&#x27;t find the patents now, so perhaps they were rejected or withdrawn. I had assumed that was why macaroons hadn&#x27;t caught on more widely.<p>Edit: Found the patent: <a href="https:&#x2F;&#x2F;patents.google.com&#x2F;patent&#x2F;US9397990B1&#x2F;" rel="nofollow">https:&#x2F;&#x2F;patents.google.com&#x2F;patent&#x2F;US9397990B1&#x2F;</a>
评论 #39207978 未加载
评论 #39208230 未加载
评论 #39206893 未加载
评论 #39206596 未加载
djha-skin超过 1 年前
Macaroons are a cookie[1], Macarons are a French dessert[2].<p>I have a pet peeve about this mix-up in particular, and they seem to have mixed them up, calling the French thing macaroons.<p>1: <a href="https:&#x2F;&#x2F;www.savoryexperiments.com&#x2F;almond-coconut-macaroons&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.savoryexperiments.com&#x2F;almond-coconut-macaroons&#x2F;</a><p>2: <a href="https:&#x2F;&#x2F;sallysbakingaddiction.com&#x2F;french-macarons&#x2F;" rel="nofollow">https:&#x2F;&#x2F;sallysbakingaddiction.com&#x2F;french-macarons&#x2F;</a>
评论 #39211297 未加载
评论 #39212545 未加载
评论 #39212289 未加载
评论 #39221754 未加载
ijustwanttovote超过 1 年前
Small detail, there&#x27;s a picture of macarons and not macaroons.<p>A macaron is a sandwich-like cookie that&#x27;s filled with jam, ganache, or buttercream. A macaroon is a drop cookie made using shredded coconut.
评论 #39209376 未加载
评论 #39210204 未加载
sergioisidoro超过 1 年前
So, are Macaroons are like a &quot;blockchain&quot;, where each block is an attenuation (ie reducing permission and scopes) of the permission of the original token? So a bearer can get a token, reduce its scope (without talking to the server) and pass it down to other less privileged entities. That&#x27;s cool!<p>I kind of had to look into the paper linked to really understand what they are. I feel the article could have given a bit more context on it :)
评论 #39205868 未加载
评论 #39206300 未加载
评论 #39219532 未加载
X-Istence超过 1 年前
Macaroons are also implemented and used by pypi.org&#x27;s implementation named Warehouse:<p><a href="https:&#x2F;&#x2F;warehouse.pypa.io&#x2F;development&#x2F;token-scanning.html" rel="nofollow">https:&#x2F;&#x2F;warehouse.pypa.io&#x2F;development&#x2F;token-scanning.html</a><p>Also see:<p><a href="https:&#x2F;&#x2F;pypitoken.readthedocs.io&#x2F;en&#x2F;latest&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypitoken.readthedocs.io&#x2F;en&#x2F;latest&#x2F;</a>
评论 #39205692 未加载
RustyRussell超过 1 年前
Compulsory plug when someone uses macaroons: using an HMAC is overkill.<p>See <a href="https:&#x2F;&#x2F;github.com&#x2F;rustyrussell&#x2F;runes">https:&#x2F;&#x2F;github.com&#x2F;rustyrussell&#x2F;runes</a> for a simpler alternative and implementation (this has C and Python, but there&#x27;s also a Rust implementation because why not?)<p>However, the &quot;no db access&quot; property has proven to be untenable in practice. Users end up wanting to see what runes are issued, blacklist them, know when they were last used, and have rate limits. The last two are a killer, requiring some state to be kept (unless your system allows you to return a modified rune to the user, which is a different workflow from normal bearer creds).
评论 #39227324 未加载
评论 #39211035 未加载
evancordell超过 1 年前
&gt; The community that formed around building open source “standard” Macaroons decided to use untyped opaque blobs to represent candidates.<p>I assume &quot;candidates&quot; was supposed to be &quot;caveats&quot; - and as an author of a &quot;standard&quot; macaroon implementation, I completely agree that this is the biggest downfall of Macaroons. With no common caveat language (and no independent &quot;dischargers&quot;) it really limits their use to within a single org. And at that point you&#x27;re basically asking everyone to invent their own token format anyway.<p>Though I don&#x27;t personally use them much anymore - I think the use-cases for Macaroons are much more limited if you have a Zanzibar! - I appreciate seeing Macaroon discussions pop up and this post and the related discussions it linked out to were a great read.
评论 #39212236 未加载
Arelius超过 1 年前
These look pretty useful cool...<p>I&#x27;m curious a bit though, here, and in other posts in HN, I often see that HMAC, a symmetric key is preferred, going as far as suggesting, in JWT, that other algorithms should not be implemented. Why is that? What are the problems with say RSA? (Ignorning that I&#x27;m not sure Asymmetric keys work with Macaroons design at all)<p>From my perspective, Asymmetric keys have been a great boon, in that I can keep the private key, secured on my single auth server, but then freely distribute the public key to the edge, greatly increasing responsiveness, and reducing the bottleneck on the Auth server.<p>Is there some security concern I&#x27;ve been missing?
jszymborski超过 1 年前
This post was written exceedingly well. Few posts execute humour and whimsy without coming off as insincere or just not very funny (I&#x27;m guilty myself).<p>Bravo!
评论 #39206750 未加载
jzelinskie超过 1 年前
It&#x27;s probably more relevant to your previous blog post that did a survey of technologies, but I&#x27;m curious if y&#x27;all ever considered a fully centralized approach. Is there something about Fly that benefits from a decentralized approach?<p>Disclosure: I work on SpiceDB alongside maintainers like the pymacaroons author
评论 #39205185 未加载
alexissantos超过 1 年前
Off topic, but related: The art you see on Fly posts? It&#x27;s made by the inimitable Annie Rugyt: <a href="https:&#x2F;&#x2F;annieruygtillustration.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;annieruygtillustration.com&#x2F;</a> She&#x27;s wonderful, and has a knack for making brands come alive with illustration.<p>Remember the RethinkDB mascot? That was her too!
评论 #39212793 未加载
matthewaveryusa超过 1 年前
&gt;and escape hatches like Mutation (for our GraphQL API).<p>Can you explain in a bit more detail what you mean by escape hatches (sounds dangerously fun)
评论 #39204994 未加载
michelpp超过 1 年前
I like the &quot;solve the now&quot; perspective here, and having code examples is very helpful to understand some of the rational behind the approach. Having read your previous &quot;tedious survey&quot;[0] post on various token formats, I generally agree with a lot of your conclusions. Curious though about your thought process wrt macaroons vs biscuits.<p>To me the one major downside of macaroons has always been the single shared root symmetric key. Many use cases are addressed by third party attenuation, but then there are the problems like key rotation, having to do online verification, no built in encryption, no peer-to-peer support through an &quot;untrusted&quot; fly.io, and no third party token verification without decryption like in signcryption[1] schemes. Of course this is traded off by having to do PK issuance and management so I can see the simplicity of it.<p>Is fly.io scoping this pretty hard to just auth tokens with third party attenuation, or do you see further development and maybe moving to other token systems like biscuit when&#x2F;if the need arises to address those known issues?<p>fwiw I&#x27;ve done a bit of research work myself on a token format using signcryption [2] where I explored addressing some of these ideas (but not the attenuation side of it yet, which I get is a big deal here).<p>[0] <a href="https:&#x2F;&#x2F;fly.io&#x2F;blog&#x2F;api-tokens-a-tedious-survey&#x2F;">https:&#x2F;&#x2F;fly.io&#x2F;blog&#x2F;api-tokens-a-tedious-survey&#x2F;</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;jedisct1&#x2F;libsodium-signcryption">https:&#x2F;&#x2F;github.com&#x2F;jedisct1&#x2F;libsodium-signcryption</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;michelp&#x2F;pgsodium&#x2F;blob&#x2F;feat&#x2F;signcryption-tokens&#x2F;sql&#x2F;pgsodium--3.1.7--3.2.0.sql">https:&#x2F;&#x2F;github.com&#x2F;michelp&#x2F;pgsodium&#x2F;blob&#x2F;feat&#x2F;signcryption-t...</a>
评论 #39205661 未加载
xyzzy_plugh超过 1 年前
&gt; Until now! I dragged Fly.io into implementing them. Suckers!<p>Let&#x27;s be real: they knew you would do this eventually. It was inevitable.
ramchip超过 1 年前
I&#x27;m curious why the connection from Rails is &quot;mTLS-y&quot; rather than actual mTLS. The macaroon repo mentions a Noise transport. Maybe to avoid dealing with X.509 certificates by distributing trusted public keys via LiteFS?<p>&gt; We didn’t use the pre-existing public implementation because we were warned not to. [...] Macaroons decided to use untyped opaque blobs to represent caveats. We need things to be as rigidly unambiguous as they can be.<p>Another place where the implementations are limiting is in the nonce for discharge macaroons: it has to match the &quot;challenge&quot; exactly. I think the fly.io implementation makes the nonce a structured object that includes the challenge &#x2F; key ID as a field, and extracts that field during third party caveat verification, which is nice. It makes it possible to include a random nonce (in the cryptographic sense) or revocation ID for instance.<p>I experimented recently with discharges containing service-specific info, e.g. a discharge from an auth service could contain the user&#x27;s name (for logging), etc. It felt dangerous though, because there&#x27;s potential for confusion on which service is allowed to provide what info - if we have a 3P caveat for an auth service and a revocation checking service, we want to be sure that the user profile info comes from the auth service, not the other one, and it gets complicated to encode that in the token.<p>Maybe this is what &quot;proof&quot; macaroons solve? They&#x27;re not mentioned in the blog post or macaroon-thought.md, but seemed to be about making positive statements on something.
评论 #39216509 未加载
评论 #39214932 未加载
wereHamster超过 1 年前
I wonder why they went chose macaroons over biscuits. The later is only mentioned once in that article, but doesn&#x27;t talk about why they were not selected.
评论 #39205537 未加载
评论 #39205722 未加载
fovc超过 1 年前
Surprised to see JSON here. I recall discussing JWT with tptacek a few years ago, and one of the concerns was the {a: x, a: y} ambiguity in JSON parsers. Was that a concern with this design?<p>My other reaction was that this sounds scary:<p>&gt; a token with no caveats restricts nothing. It’s a god-mode token. Don’t honor it.<p>I guess it&#x27;s technically &quot;fail closed&quot; but seems kind of brittle
评论 #39206166 未加载
评论 #39206720 未加载
bethecloud超过 1 年前
Storj is also leveraging macaroons. Great write-up on decentralized access control here: <a href="https:&#x2F;&#x2F;medium.com&#x2F;@kleffew&#x2F;what-is-capability-based-security-227c6e5483a5" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@kleffew&#x2F;what-is-capability-based-securit...</a>
8organicbits超过 1 年前
&gt; we want Macaroon tokens to be safe to transmit between users<p>How does this work for auditing? If user A gives user B a token (perhaps after adding a caveat) how does this system audit log determine who did what? Does that require a third party system?
评论 #39205866 未加载
评论 #39205947 未加载
xbar超过 1 年前
I am not a customer, but I do like the fly.io &quot;voice.&quot;
asplake超过 1 年前
Typo&#x2F;bug: pretty sure variable &#x27;oldTag&#x27; should be &#x27;oldTail&#x27;
评论 #39204849 未加载
beeks超过 1 年前
it seems to me that macaroons could get quite big in order to adequately describe allowed resources and permissions? Especially if the API is broad? Much bigger than JWTs.
评论 #39210030 未加载
ssl232超过 1 年前
TIL macarons [1] are also known as macaroons [2]. Where I&#x27;m from, macaroons are dense, sweet coconut treats and the French sweets are known as macarons. But from the Wikipedia article I see macaroons mean many different things to many different people.<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Macaron" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Macaron</a><p>[2] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Macaroon" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Macaroon</a>
评论 #39204789 未加载
评论 #39204995 未加载
评论 #39204830 未加载
评论 #39204681 未加载
评论 #39204616 未加载
评论 #39209659 未加载
评论 #39204700 未加载
评论 #39204695 未加载
DonsDiscountGas超过 1 年前
The title and graphic suggest an article about the most delicious treat known to humans, and the post is about software. My disappointment is immeasurable and my day is ruined.
评论 #39205965 未加载
评论 #39204906 未加载
评论 #39205114 未加载
评论 #39205015 未加载
评论 #39205050 未加载
评论 #39205354 未加载
elbasti超过 1 年前
What I really want to know is how fly.io has recruited such talent. @tptacek (who wrote this article), @chrismccord (creator of elixir Phoenix&#x2F;Liveview), and others.<p>Very impressive, but also slightly worrying since some parts of fly.io have such terrible DX&#x2F;documentation. I&#x27;ve only recently started using them, but the documentation around billing and databases is shockingly bad for a team that is clearly so deeply stacked.
评论 #39206014 未加载
评论 #39205625 未加载
评论 #39206605 未加载
iou超过 1 年前
lol, the picture in the post is of a macaron, not a macaroon<p><a href="https:&#x2F;&#x2F;www.foodnetwork.com&#x2F;recipes&#x2F;packages&#x2F;baking-guide&#x2F;macarons-vs-macaroons-whats-the-difference" rel="nofollow">https:&#x2F;&#x2F;www.foodnetwork.com&#x2F;recipes&#x2F;packages&#x2F;baking-guide&#x2F;ma...</a>
评论 #39205360 未加载