Support destination port range in config.rbac.Permission
I am using config.rbac.Permission to configure RBAC for a dynamic forward proxy.
My proxy configuration needs to support allowing large port ranges.
Today, I can achieved this by combining thousands of Permission.destination_port rules using Permission.Set.or_rules, similar to this (modified) snippet from the config.rbac.RBAC docs.
"product-viewer":
permissions:
- and_rules:
rules:
- header: { name: ":method", exact_match: "GET" }
- url_path:
path: { prefix: "/products" }
- or_rules:
rules:
- destination_port: 1000
- destination_port: 1001
# .
# ... a lot of lines
# .
- destination_port: 1999
This is functional but cumbersome.
It would be more ergonomic if Permission had a destination port range field, similar to what exists in config.listener.ListenerFilterChainMatchPredicate.
+1 to this. This not only makes the config simpler but also has the potential to greatly improve the performance by using some highly efficient data structure and algorithm for the matching.
In the future we probably could/should expand this design to other fields like path/header/IP where we know some people puts hundreds and thousands values in these fields.
I think it is reasonable, since rules are too complicated to write currently. I will try to improve it.