https://cerbos.dev logo
#community
Title
# community
r

Rasmus Dencker

06/09/2022, 4:00 PM
I could check the source, but I'm too lazy 😂 Does Cerbos cache auxdata.jwt to not validate signatures on each request?
c

Charith (Cerbos)

06/09/2022, 4:03 PM
The keys are cached but not the JWT itself. Caching is a bit difficult to do because of all the little things that could change between requests so we don't do it at the moment
If you have a validating gateway for the JWT and can trust the internal network, then you can switch off JWT verification in Cerbos.
r

Rasmus Dencker

06/09/2022, 4:16 PM
We're working with the zero trust paradigm, so the latter is not an option, thanks for the suggestion though. IMHO a JWT token signature validation is a perfect subject for in-memory caching; it's size is predictable and relatively short (doesnt need to be hashed when its in-memory) and cache TTL is really predictable, too. It's only really relevant if each cerbos instance has an in-memory LRU cache, though. The tradeoffs of using an external cache (hashing + interchanging data) are to high compared to validating the signature.
just a simple ARC/LRU would suffice
but when running in production it's probably just a matter of nanoseconds anyway
so we'll just design around it (batch checking permissions for instance)
There's some invalidation to take care of when the Keyset changes, but thats all I can think of*
c

Charith (Cerbos)

06/09/2022, 4:22 PM
Yeah, that's the thing. Even though it seems fairly simple, there are a few edge cases that complicate things. Since it's relatively fast, we left out caching for later. It would be good to hear about your experience here. If verification is adding a lot of overhead, we can try to expedite implementing caching for JWT 🙂
r

Rasmus Dencker

06/09/2022, 4:25 PM
yeah every new feature costs time, and there's likely some features in the pipeline that provides a lot more value! so no worries, I don't think it's going to be a big problem at all.
c

Charith (Cerbos)

06/09/2022, 4:28 PM
Keep us posted about your progress and any issues you run into. We're happy to help.
r

Rasmus Dencker

06/09/2022, 6:47 PM
Just chipped in with a couple of thoughts. Thanks for opening the issue, Charith!
👍 1
7 Views