-
Notifications
You must be signed in to change notification settings - Fork 55
fix(sdk): ban rate-limited node for Envoy-advertised reset window #3951
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
72b6f6b
fix(rs-dapi-client): rotate instead of ban on ResourceExhausted rate-…
lklimek fadedd4
Merge branch 'v3.1-dev' into fix/rs-dapi-client-rate-limit-rotate
lklimek 396865f
fix(rs-dapi-client): exclude throttled node + backoff/jitter on rate-…
lklimek b8a8c32
fix(rs-dapi-client): clamp rate-limit backoff shift + symmetric invar…
lklimek 8a41c92
fix(rs-dapi-client): replace rotate-on-rate-limit with Envoy-driven b…
lklimek c905b16
refactor(rs-dapi-client): drive rate-limit ban from Envoy reset heade…
lklimek dade457
test(rs-dapi-client): apply QA-001..005 doc-accuracy and test-honesty…
lklimek 2c76a14
Merge branch 'v3.1-dev' into fix/rs-dapi-client-rate-limit-rotate
lklimek 47f4160
fix(rs-dapi-client): apply PR-3951 review fixes — ban_for max-semanti…
lklimek be6ae84
test(rs-dapi-client): restore genuine window-expiry coverage in ban_f…
lklimek 41cc076
docs(rs-dapi-client): QA-006/007/008 — ban_with_reason scope note + n…
lklimek ddfe16c
docs(rs-dapi-client): tighten ban_for/ban_with_reason scope docs; har…
lklimek caa025e
feat(dashmate): add platform.gateway.rateLimiter.responseHeaders.enab…
lklimek c49adb2
fix(dashmate): key responseHeaders migration at 4.0.0 not released rc.2
lklimek 458a28e
test(rs-dapi-client): prove ban_for via DapiClient::execute end-to-en…
lklimek b23008e
fix(dashmate): key responseHeaders migration at next release 4.0.0-rc…
lklimek 3a9cf45
feat(dashmate): reorder gateway filters (cors,grpc_web before ratelim…
lklimek 6818f3e
fix(dashmate): make grpc-web over-limit a trailers-only ResourceExhau…
lklimek 5d45556
chore: gitignore .env.*.bak to prevent committing backup env files
lklimek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like I suggested the wrong direction. I mean, the ban system is correct, but exposing headers that are disabled by default and enabling them via env is risky. Could you please investigate what consequences and why it's disabled by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Investigated — thanks for flagging, the caution is fair. Summary:
What the flag exposes:
LIMIT_RESPONSE_HEADERS_ENABLED=truemakes the Lyft RLS populateRateLimit-Limit/RateLimit-Remaining/RateLimit-Reseton theRateLimitResponse. Per the RLS source (src/service/ratelimit.go) these are emitted on every response (OK and over-limit), not only on 429. (This is the RLS-side flag — distinct from Envoy's ownenable_x_ratelimit_headers, which emits the differently-namedx-ratelimit-*and is not what the client parses.)Why it's off by default upstream: it's an opt-in, backward-compatible addition whose default header names track a non-final Internet-Draft (draft-ietf-httpapi-ratelimit-headers, still
-11, not an RFC), and that draft's own Security Considerations caution against disclosing capacity info to untrusted parties — so a conservative "off" is the natural upstream default.Actual risk for Dash: low. The headers are advisory only — verified they do not change enforcement (the over-limit decision is computed independently of header emission). What they reveal is the caller's own per-IP rate-limit policy (limit / remaining / reset), which is public-by-design and already discoverable by probing (send until 429, watch when it clears). No secrets, backend capacity, topology, or other-tenant data leak.
Recommendation: not a blocker. The cleanest resolution to exactly your concern is to gate this behind a documented dashmate config toggle (default on, since the ban-for-duration feature depends on the header) rather than a hard-coded env var — operators get a visible switch instead of a buried
=true. One sharper note:rs-dapi-clientonly consumesratelimit-reseton the over-limit (ResourceExhausted) path, so emitting the headers on successful responses is pure disclosure surface with zero benefit to our client; restricting emission to over-limit responses would be strictly better, though the Lyft flag is all-or-nothing so that needs Envoy-layer shaping (nice-to-have, not required).Implemented in this PR (commit
c49adb26e2): the hard-codedLIMIT_RESPONSE_HEADERS_ENABLED=trueis now driven by a first-class dashmate config option —platform.gateway.rateLimiter.responseHeaders.enabled(default on, since the ban-for-duration feature depends on the header). A config migration keyed at4.0.0back-fills the field (default on) for existing deployments so an upgrade never silently disables it, andpackages/dashmate/docs/config/gateway.mddocuments the privacy trade-off so a cautious operator can switch it off. You now get the visible, documented switch instead of a buried=true.🤖 Co-authored by Claudius the Magnificent AI Agent