xds: reject rbac not_rule/not_id with no inner matcher#9220
Open
nvxbug wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
matchersFromPermissions and matchersFromPrincipals build a not_rule/not_id by recursing on a single-element slice and then reading mList[0]. The recursion returns nothing when the wrapped inner rule is one gRPC RBAC does not turn into a matcher: an empty inner rule, a requested_server_name or non-inverted metadata permission, or a deprecated source_ip / metadata principal. An RBAC config carried in an xDS HTTP filter (or an authz policy) with a not_rule{} or not_id{} of that shape indexes an empty slice and panics during resource parsing, and nothing recovers it in the xdsclient decode path.
Return an error from the two builders when the inner rule produces no matcher, so the resource is rejected the way other invalid RBAC fields are instead of crashing the process. Keeping the check next to the mList[0] read covers the permission and principal sites with the same guard.
RELEASE NOTES: