envoyproxy / ratelimit

Go/gRPC service designed to enable generic rate limit scenarios from different types of applications.
Apache License 2.0
2.27k stars 442 forks source link

How to use a hash of descriptor instead of a raw descriptor? #699

Open andrii-korotkov-verkada opened 1 month ago

andrii-korotkov-verkada commented 1 month ago

Hello, I hope your day is going well. There's a use case of rate limiting per auth token (stored in a header), which effectively means rate limit per caller. However, it's not desired to store a raw token in Redis as a part of a key. What's the best way to get a hashed value of the auth token to be used as a descriptor? Thanks.

jespersoderlund commented 3 weeks ago

How about creating the hash in a lua-script in your envoy config and put it into a dynamic variable and use that to ratelimit on?