biscuit-auth / biscuit

delegated, decentralized, capabilities based authorization token
Apache License 2.0
961 stars 25 forks source link

Forgotten symbol in samples.json? #137

Closed arnsholt closed 1 year ago

arnsholt commented 1 year ago

For the second block of test009_expired_token.bc, samples.json says there should be a symbol expiration: https://github.com/biscuit-auth/biscuit/blob/ef72348c4b6c0906829433fadf4df2573db000f4/samples/current/samples.json#L439 but since that symbol doesn't occur in the code for the block, I think it has to be a symbol left over from a previous version of that sample, or something along those lines?

divarvel commented 1 year ago

oh, good catch!

It is not a leftover from a previous version of the sample, rather to a small quirk in the encoding of checks' bodies in the biscuit-rust library. They are modeled as rules internally, and expiration is used as the predicate name for the rule head. But this rule head is not actually used, so it does not make sense to waste space on this name.

There is a little bootstrapping issue here, since the canonical way of defining checks in rust code is to use macros, but they are not available from the library itself (they are feature-gated). The check_expiration_date builds the check manually, but in a way that's a bit different from what's done in the macros / parser.

divarvel commented 1 year ago

see https://github.com/biscuit-auth/biscuit-rust/blob/main/biscuit-auth/src/token/builder.rs#L2278