Add rate limits initial documentation - #1450
Conversation
Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
martinflorian-da
left a comment
There was a problem hiding this comment.
Thanks a lot! I do expect we'll need to tweak this more going forward but this is super helpful to maintain an overview.
My main nudge at this time would be to remove references to SV app...
| </Warning> | ||
|
|
||
| ```hocon | ||
| canton.scan-apps.scan-app.parameters.rate-limiting.client-ip-headers = ["x-envoy-external-address"] |
There was a problem hiding this comment.
This seems to miss a sentence about "what is this snippet here telling me".
It will also confuse people not used to thinking about the low-level HOCON configs; WDYT of making these two name: ADDITIONAL_CONFIG_... style snippets instead?
...and possibly we also want to expose these via Helm values at some point? (So might need a hook here to replace with Helm value overrides if we end up enabling these.)
|
|
||
| Both limits must be enforced over a **fixed window of 60 seconds**. A client is allowed at most `limit` requests per 60s window; once the budget for the current window is exhausted, all further requests from that client (or, for the global limit, to that service) are rejected with `429 Too Many Requests` until the window rolls over. | ||
|
|
||
| For the sequencer, limits must be applied to gRPC traffic requests. |
There was a problem hiding this comment.
How confident are you that you can throw "gRPC traffic request" at operators and they'll end up configuring the right thing? Can this be mapped to something on a lower layer (HTTP2?)?
There was a problem hiding this comment.
I expect that most proxies have native support for gRPC. Will just switch to gRPC (HTTP2)
I definitely expect we keep evolving this in the short to medium term, but wanted to front run this so that SVs can also get a head start on basic rate limits. |
Co-authored-by: Martin Florian <martin.florian@digitalasset.com> Co-authored-by: Nicu Reut <nicu.reut@digitalasset.com>
|
@stas-sbi asking for a review from you as well to make sure we're aligned on the initial version/requirements for infra rate limiting |
giner
left a comment
There was a problem hiding this comment.
Looks good to me! Left a few minor comments
| The default headers (`x-forwarded-for`, `x-real-ip`) are client-controlled and can be spoofed. A client rotating the header value bypasses per-client-IP limits entirely. | ||
|
|
||
| Every SV operator must therefore either configure their ingress to **overwrite** (not append to) the header the apps read, or point `client-ip-headers` at a header the client cannot influence. With an Istio/Envoy ingress the recommended value is the non-spoofable `x-envoy-external-address`. Make sure the number of trusted XFF hops on your gateway matches your actual topology, so Envoy derives the real client IP. |
There was a problem hiding this comment.
Considering that the terms spoofable and non-spoofable are meaningless outside of specific context I'd like to suggest simplifying this section and replacing it with something like:
The default value for
rate-limiting.client-ip-headersis set to["x-forwarded-for", "x-real-ip"]as a convenience trade-off. Every SV operator must configure setrate-limiting.client-ip-headersto the header fully controlled (rewritten, not passed through or appended to) by their ingress. For example["x-forwarded-for"]or["x-envoy-external-address"].
| The following infrastructure level rate limits should be configured. These limits should apply individually to the Scan API and the sequencer gRPC API. | ||
|
|
||
| - **Global limits**: a cap on the total request rate reaching a given service. | ||
| - **Per-source-IP limits**: a cap on the request rate of a single client IP, so a single client cannot consume the global budget. |
There was a problem hiding this comment.
it would make sense to note that these limits are last resort and they must be higher than app limits
|
|
||
| Both limits must be enforced over a **fixed window of 60 seconds**. A client is allowed at most `limit` requests per 60s window; once the budget for the current window is exhausted, all further requests from that client (or, for the global limit, to that service) are rejected with `429 Too Many Requests` until the window rolls over. | ||
|
|
||
| For the sequencer, limits must be applied to gRPC(HTTP/2) traffic requests. |
There was a problem hiding this comment.
this sounds as if there were other options but I can't think of any, so I'm not sure what this comment intends to say
There was a problem hiding this comment.
leaving it there just so that it's extra explicit
|
|
||
| ### Shared rate limiter configuration | ||
|
|
||
| The same shared rate limiter configuration file that defines application-level overrides will also define a number of infrastructure level configurations (global and per-IP limits, the 60s rate limiting interval, per IP overrides, and any ban thresholds) that should be applied to the ingress by the SV operator. |
There was a problem hiding this comment.
should this say suggested infrastructure level configurations?
nicu-da/cips#1
https://github.com/DACH-NY/canton-network-internal/issues/6475