Skip to content

xds: reject EDS drop policy with unsupported denominator#9218

Open
nvxbug wants to merge 1 commit into
grpc:masterfrom
nvxbug:eds-drop-denominator
Open

xds: reject EDS drop policy with unsupported denominator#9218
nvxbug wants to merge 1 commit into
grpc:masterfrom
nvxbug:eds-drop-denominator

Conversation

@nvxbug

@nvxbug nvxbug commented Jul 2, 2026

Copy link
Copy Markdown

parseDropPolicy maps a FractionalPercent denominator to a divisor with a switch that has no default, so an EDS drop_overload carrying an unknown denominator enum value leaves the divisor at 0. That value reaches clusterimpl, which evaluates d.Numerator * million / d.Denominator, and a management server sending such a resource crashes the client with an integer divide-by-zero.

Reject the unsupported denominator while parsing the resource so it is NACKed, matching how parseEDSRespProto already errors on other malformed fields. Validating in the parser keeps the balancer free of divisor checks and stops one bad resource from taking down the client.

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.30%. Comparing base (26ffdb3) to head (4eabde4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9218      +/-   ##
==========================================
+ Coverage   83.22%   83.30%   +0.08%     
==========================================
  Files         420      420              
  Lines       34024    34030       +6     
==========================================
+ Hits        28317    28350      +33     
+ Misses       4275     4256      -19     
+ Partials     1432     1424       -8     
Files with missing lines Coverage Δ
...nternal/xds/xdsclient/xdsresource/unmarshal_eds.go 96.22% <100.00%> (+0.14%) ⬆️

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant