9 ms·
Biscuit authorization
- bluepuma77 3y agoInteresting to see "Portable - Biscuit is implemented in Rust, Haskell, Go, Java, WebAssembly, C..." but nothing about Javascript, NodeJS and Python, which seem very common these days.
- ptman 3y agowebassembly may be useable in many javascript environments
- Lio 3y agoAccording to their docs, the NodeJS and Python libraries seem to be wrappers around the Rust implementation. In the case of NodeJS they're using WebAssembly to run the compiled Rust code, which is an interesting approach. If they're just going to wrap the rust implementation, I'm surprised they haven't offered Ruby FFI or PHP FFI wrappers too.
- DeathArrow 3y agoAfter cookies, now we have biscuits. How about some Tiramisu?
- globular-toast 3y agoI'm disappointed at the lack of relevance of these confectionary-related names. "Cookie" means "small cake" (in other languages, the word "cook" and "cake" are the same word). "Biscuit" means "twice cooked" (from Latin bis (twice) and French cuit (cooked)). It's already disappointing that cookie and biscuit are considered synonymous but simply American vs British when there is a meaningful distinction. Cookies are just small cakes, biscuits are small cakes that are baked again to dry them out. These technologies seem to have nothing to do with the foods, though.
- quadhome 3y agoI ported biscuit-java to Kotlin for an internal project. In the course of doing so, I went from a naive superfan to a somewhat grizzled advocate. Here's my high level summary: Why Biscuit instead of JWTs? tl;dr, Biscuit (and Macaroons) can attenuate, JWTs can't. Read: https://fly.io/blog/api-tokens-a-tedious-survey/ https://fly.io/blog/api-tokens-a-tedious-survey/ What does this mean? Let's say you're given a token to access System A and B whenever and however you want. You can create a new token from your token that only gives access to System A for the next 5 minutes. Basically: attenuation gives a capability system. Why Biscuit instead of Macaroons? tl;dr Biscuits are easier to understand (and implement) than Macaroons. Watch: https://www.youtube.com/watch?v=MZFv62qz8R https://www.youtube.com/watch?v=MZFv62qz8R Macaroons are clunky and hard to work with in practice. That's probably not a feature you want in your choice of token technology. Biscuits contain simple facts and clear policies written in Datalog. Why NOT Biscuits? Immaturity. - AFAIK there is no compliance suite for all the Biscuit libraries linked https://www.biscuitsec.org/ https://www.biscuitsec.org/; and as such, unsurprisingly, there are corner case incompatibilities, especially in the authorization language parsers and Datalog expressions/operators. - The Datalog runtime limits are user-defined. What is the maximum number of facts, application iterations, or even timeouts? That's up to you. - Biscuit v2 (v3-4 in the proto) is the Official Latest Version. Some of the libraries support the older versions to varying degrees.. and the way that backwards compatibility is implemented gave me pause. - Whole sections of the specification are `TODO`. - The Datalog data types are bounded by the underlying protobuf definitions; and the libraries use the language native data types. There are casts and undefined behaviour at the extremes. - Many of the libraries do little things like calling the equivalent of `Time.now()` internally. IMHO this sort thing should be stateless. - There's heaps of tests, which is great! But, I didn't see any fuzz or property tests, which is less great. In Summary... Biscuits neatly package several simple and solid technologies: datalog, ed25519, protobufs. Once the ecosystem is mature, it'll be incredible.
- clementd 3y ago(biscuit maintainer here) thanks for the kind words! as for the compliance suite, there is one: https://github.com/biscuit-auth/biscuit/tree/main/samples/current https://github.com/biscuit-auth/biscuit/tree/main/samples/cu... which has been instrumental when i implemented biscuit-haskell. It might not cover anything, but it is updated everytime a new corner-case is identified. could you elaborate wrt backward compatibility? The current model is opt-in, so you only pay for the features you use (that allows incremental updates, with biscuit-rust and biscuit-haskell leading the pack). I see two todos in the spec indeed, i'll have a go at filling them out (they are implied by the rest of the spec and are implemented consistently across the various libraries, so it's more of a "writing things down" issue. I do agree that the spec is not airtight as it is. The compliance suite is there for that as it disambiguates a lot of things. Other points are about library specifics. I know biscuit-rust and biscuit-haskell very well, biscuit-java less so. It is a bit lagging since the company working on it has had trouble allocating time on it. In any case, if you have issues with specific things in libraries, don't hesitate to ping maintainers or open issues to see what we can do. biscuit-rust and its derivatives are actively maintained. biscuit-haskell is rather stable (but lacks support for snapshots). biscuit-java and biscuit-go are in need of some love, but nothing undoable
- jgalt212 3y agoIf you solve stateless token revocation, you've broken the laws of physics.
- motohagiography 3y agoSomething like this needs traction. The concept is essentially a "policy DSL," where we need a domain specific language for describing authorization across the internet. The other feature a DSL should have is a 5W's approach, of who, what, when, where, why, and how - as this will make it consistent with most business logic and also any logging and audit requirements, as this is how humans describe things. I can see why they are using a concrete language based on security concepts to describe the authorizations, but the next level would be a more general subject-predicate graph form. The risk there is losing consistency when users and developers don't abstract it well, so maybe biscuitsec has got it right. All authN systems die of overspecification, and so the best solution will be the one people actually use. Several years ago I was looking at doing a "blockchain policy DSL," where users could federate applications by subscribing to and caching parts of the chain, but there wasn't enough product juice in it to pursue (I've done a lot of IAM and digital identity work over the years). This biscuitsec authZ token has a lot of the right ideas. It's a hard problem that needs fewer solutions and just one viable product.
- deleted 3y ago[deleted]
- mike_d 3y agoA better explainer: https://www.clever-cloud.com/blog/engineering/2021/04/12/introduction-to-biscuit/ https://www.clever-cloud.com/blog/engineering/2021/04/12/int...
- gnabgib 3y agoSomewhat? Browser cookies can literally contain anything (not just session identifiers, or authentication tokens), I've only heard JWT pronounced "Jay-double you-tea" (but maybe that's regional), Macaroons[0] and Maracrons[1] are French (given clever-cloud is french, this is strange), OPA doesn't need to be server side. [0]: https://en.wikipedia.org/wiki/Macaroon https://en.wikipedia.org/wiki/Macaroon [1]: https://en.wikipedia.org/wiki/Macaron https://en.wikipedia.org/wiki/Macaron
- brontitall 3y agoI think the RFC pronunciation guide > the same as the English word "jot". Only makes sense if your dialect has the cot-caught merger[0] [0] https://en.wikipedia.org/wiki/Cot%E2%80%93caught_merger https://en.wikipedia.org/wiki/Cot%E2%80%93caught_merger
- OJFord 3y agoI don't, so perhaps I'm just doomed not to understand, but I still don't get that? I would never pronounce it 'jaught' either (nor know what someone meant if they did).
- airstrike 3y agoOnly barely makes sense, you mean. And only if you squint...
- gnabgib 3y agoYou skipped an important part of the quote from RFC-7519[0] (later replaced by two RFCs[1],[2] without the strange suggestion): > The suggested pronunciation of JWT is the same as the English word "jot". Replaced by RFC-7797[1] and RFC-8725[2], neither of which have the pronunciation suggestion. There was also an errata about the pronunciation line[3], which probably explains the mismatch. [0]: https://www.rfc-editor.org/rfc/rfc7519 https://www.rfc-editor.org/rfc/rfc7519 [1]: https://www.rfc-editor.org/rfc/rfc7797 https://www.rfc-editor.org/rfc/rfc7797 [2]: https://www.rfc-editor.org/rfc/rfc8725 https://www.rfc-editor.org/rfc/rfc8725 [3]: https://www.rfc-editor.org/errata/eid5648 https://www.rfc-editor.org/errata/eid5648
- apitman 3y agoThe offline attenuation concept is really cool. I wonder how many chained attenuations you could perform before you start to run into practical limitations with storing them attenuated token in cookies, etc.
- DaiPlusPlus 3y agoIt sounds neat - but in-practice it's something other schemes have had for yonks, albeit centralized instead of being entirely at the discretion of the subject (e.g. OAuth2's delegation grant), and there's the obvious risk of someone's token being used to counter-sign or delegate permission without their knowledge (this isn't unrealistic considering the sheer number of daily posters to StackOverflow who think browser's localStorage is an acceptable place to hold secrets and keys...).
- tptacek 3y agoWhat do you mean? How do you do an offline attenuation of an OAuth2 token?
- DaiPlusPlus 3y agoYou can’t do it offline; but in practice that isn’t a problem because IdPs generally are five-nines available.
- tptacek 3y agoNo, it is a problem, because the motivating use case for offline attenuation is doing JIT minimization of tokens before sending them. IdP OAuth2 tokens tend to be all-powerful, a game-over break if stolen. That's why offline attenuation was invented. You can say that offline attenuation and minimization doesn't matter; for a lot of applications, it probably doesn't. But you can't say OAuth2 has the same feature, and certainly not "had for yonks".
- nmadden 3y ago
- throwoutway 3y agoReminds me of macaroons. Has anyone done a comparison? https://backstage.forgerock.com/docs/am/7/oauth2-guide/oauth2-macaroons.html https://backstage.forgerock.com/docs/am/7/oauth2-guide/oauth... https://research.google/pubs/macaroons-cookies-with-contextual-caveats-for-decentralized-authorization-in-the-cloud/ https://research.google/pubs/macaroons-cookies-with-contextu...
- arnarbi 3y ago(author of the paper in your second link, which the Biscuit spec also references) Macaroons are an abstract thing. They don't define an encoding format, nor any semantics or language for the caveats. So a lot of detail is left up to the implementer, which is why they're fairly hard to use. Their basic form is also built on symemtric keys and hmacs, so only the issuer can verify, which is a significant limitation in the real world. AFAICT Biscuits define those (protobuf for encoding, a logic language for the caveats) and use public keys instead to allow other parties than the issuer (=holder of the root key) to verify them.
- jslakro 3y agoHMAC is used with the same purpose as in FIDO?
- arnarbi 3y agoNot really, no, if you refer to them being used for chaining. In FIDO it’s just used as a plain MAC in the expected places.
- tptacek 3y agoThat abstraction is also a strength. I think one of the reasons Macaroons really resonate with security engineers is that the underlying cryptography is simple and user-proof, and the resulting formats and protocols are super flexible†, which is not a combination you typically get with cryptosystems. It's also one of the truly great security papers; having worked with a team for a year scaling them out, I get something new every time I read it. My only quibble is the internal naming ("CID", "VID"). We're doing a big-ass blog post as we speak about how our Macaroon tokens work, and it covers how we worked around the issuer/verifier constraint (spoiler: a litefs-backed replicated isolated internal API) and we did basic stuff like encoding (spoiler: we defined a rigid struct schema, and just MsgPack'd it). One of the things I think I have to say about Macaroons is that there's a sliding scale of how much you use it; I think there are some simple ideas in them that would be pretty neat in any application's authentication cookie scheme. † Also one of a couple reasons, I think, that "standard Macaroons" and their associated libraries never went anywhere.
- CobrastanJorji 3y agoThis is a neat project. That said, the documentation does this thing I see a lot where the author focuses entirely on things that are good. It repeats and clarifies things that are good (you can reduce the scopes of offline, but never increase the scope of tokens, and you can do it offline, without contacting servers. Any server can validate credentials because it uses public keys. And did we tell you about attenuating tokens?), but it kind of sweeps anything that is NOT a discriminator under a rug a bit. I don't think it's malicious. Creators get excited about the exciting bits of their project. But there are a lot of details that may or may not be present, and if I'm evaluating your thing, I want to know which exist an which don't. Given a long-term token, can I create short-term, auto-expiring tokens? Is there some revocation mechanism? How do these things line up against JWT or OAuth? When should I prefer this, but also when should I NOT prefer this? Still, I like a lot about the documentation. I love how it's not afraid to get into the weeds about EXACTLY what it does without losing the clarity. It's really easy to follow when it gets technical, which is rare.
- geal 3y ago(biscuit author here) you caught me, I can't help getting excited about the project XD > Given a long-term token, can I create short-term, auto-expiring tokens? yes, with attenuation: https://doc.biscuitsec.org/recipes/common-patterns#expiration-check https://doc.biscuitsec.org/recipes/common-patterns#expiratio... > Is there some revocation mechanism? In a token, each block has a revocation id, so if you revoke a token, all the tokens derived from that one will be revoked as well. As for how to handle those revocation ids, it's the same strategies as in other systems, reintroducing some state to check revocation lists: https://www.biscuitsec.org/docs/guides/revocation/ https://www.biscuitsec.org/docs/guides/revocation/ > How do these things line up against JWT or OAuth? When should I prefer this, but also when should I NOT prefer this? JWT has a lot of footguns, especially in the way it handles the list of algorithms, and libraries tend to all go through the same set of mistakes (a lot of them are stable now though). JWT are good to transmit a small amount of data, and are overall well supported. JWTs do not enforce any authorization system, you have to add one yourself. Biscuit is very strict in how it deserializes and verifies tokens, so it avoids the usual JWT issues (partly by its spec, partly by an extensive test suite). Biscuits can be larger than JWTs, and can take longer to verify (one signature verification per block). Biscuit comes with its own authorization, based on a logic language, that can be both carried by the token and provided by the verifier. It has implementations in a lot of languages but is not as widely supported as JWT yet. I'd say if you can live with JWTs containing a little data (like a sub to look up in DB) and a simple authz system like a RBAC, keep using it, that will work well. But if you can benefit from attenuation (ex: per request attenuation https://doc.biscuitsec.org/recipes/per-request-attenuation https://doc.biscuitsec.org/recipes/per-request-attenuation and delegation https://www.biscuitsec.org/docs/guides/microservices/ https://www.biscuitsec.org/docs/guides/microservices/ ), then look into Biscuit, it can help
- hn_throwaway_99 3y agoI was searching for a quick explainer of how revocation is implemented, but didn't find it (at least not quickly). Can anyone say how this works? Revocation is essentially the Achilles heel of JWTs - you want to have completely stateless bearer tokens, but if you need to check for revocations, it means you have to do some sort of lookup against a revocation table, and at that point you really lose the stateless nature that you wanted in the first place. There are some tricks to make this more tenable, but it's still a big reason why some folks say "don't use JWTs for end-user auth". Would greatly appreciate details on how Biscuit implements this with their "revocation IDs". Edit: Nevermind, I found it: https://www.biscuitsec.org/docs/why-biscuit/ https://www.biscuitsec.org/docs/why-biscuit/ - and it turns out revocation is a "non goal". And then in the linked page about how to implement revocations, they basically do exactly what I do for JWTs: have a revocation list, but then revocations can fall off that list once they're past the expiration date anyway. So, not to be too harsh, but why would I use this over JWTs? There is no "magic" getting around the "well, they're kinda stateless" problem. To be honest I don't really care about some of the other tangential benefits (after all, you can stick whatever you want on a JWT and interpret it however you like) if it still has by far the same glaring pain point associated with any bearer token system.
- ivanb 3y ago> Revocation is essentially the Achilles heel of JWTs By the nature of the problem you have to store some kind of a list of tokens. Either a black list as with JWTs or a white list as with classic session tokens. There is no way around it. This makes both approaches practically the same. One can argue that the black list will in general be shorter than the white list, but in a case of a serious attack, would it really be so? I am afraid that the community will now abandon JWTs and move to biscuits, macaroons, buns and meringues as they did with classic session tokens, throwing away the tools and security practices.
- deleted 3y ago[deleted]
- antran22 3y agoIn the case of a serious attack, the blacklist should be every token. You can still handle this quite nicely with JWT by rotating the previous verification key. Depends on systems and configuration, this can be as easy as changing the HMAC private key or push a new RSA key to every verifier.
- 38 3y ago[flagged]
- geal 3y ago(biscuit author here) I tried a lot of different formats, especially looking for something that generated small tokens, that could have a canonical form, and that was supported in a lot of languages. The canonical part was a dead end as most formats did not support that well. Protobuf ended up being the one which generated the smallest tokens, and was easily supported in most languages, even if, like you, I don't agree with everything in the way it's serialized. Self describing formats were a dead end as well because it grows the token size
- thadt 3y agoWhy do we feel using variable length integers in protobuf's wire format vs strings is an instant deal breaker? Isn't understanding a protocol is going to require a more documentation than just a string field name? The kind of documentation that can often be found as comments in a protocol buffer definition file? Having written a binary serialization format that does make the choice to use strings for field identifiers on the wire (https://litevectors.org https://litevectors.org), I can still see the appeal of using integers - they're smaller and parse faster. I've used protocol buffers in several places, including in an embedded microcontroller where parsing something like JSON would have been a lift. Aside from some issues with the impact of deeply nested buffers on the stack size, protocol buffers worked brilliantly, and allowed us to keep a consistent data representation across multiple languages and platforms.
- esafak 3y agoWhat do you use instead?
- isuckatcoding 3y agoReally cool concept but having a really hard time understanding the datalog language and the semantics. Like specifically what is the difference between check if and allow if?
- geal 3y agocheck if: if any one of those fails, the entire authorization fails allow if/deny if: they are tried in order, we stop at the first that matches. If an allow if matches and all checks passed, then the request is authorized
- isuckatcoding 3y agoIm not trying to be annoying but I still don’t get it. It might be easier for me with some examples. I’m sure when folks start using this, it’ll be more clear.