Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Binary Caveats? #63

Open
dstufft opened this issue Jan 22, 2024 · 1 comment
Open

Support Binary Caveats? #63

dstufft opened this issue Jan 22, 2024 · 1 comment

Comments

@dstufft
Copy link

dstufft commented Jan 22, 2024

It appears that pymacaroons requires that caveats are valid utf8 strings. Is there a reason for that?

It appears like most of the implementations/examples of Macaroons expect that you're going to create some sort of arbitrary text based DSL for your caveats, but I've preferred to use actual real serialization formats because they're going to handle the various edge cases in a much cleaner fashion than any DSL I make is going to be able to. Readability of the raw bytes of a Macaroon caveat doesn't seem to be of huge importance to me, since you're going to need some tooling to decode the Macaroon to get access to the caveats to begin with, that same tooling can just present the caveats in a more human friendly way.

However, since there is a hard check that the bytes of a caveat are valid utf8, that severely limits the choices of serialization formats to only ones that guarantee that their output is valid utf8. We've currently been using json for this, but since the size of the serialized caveats affects the size of the final macaroon we've been trying to minimize the size of our caveats where possible, and using an alternative serialization format besides JSON is one of the options we're considering.

Is there a reason why caveats need to be valid utf8 strings, or can this restriction be relaxed to support arbitrary bytes?

@dstufft
Copy link
Author

dstufft commented Jan 22, 2024

Note: It looks like the requirement for utf8 caveats might come from v1 serialization, but pymacaroons doesn't seem to limit this restriction to only v1, and just unconditionally requires it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant