xds/rbac: skip degenerate empty URI SANs in authenticatedMatcher#9123
Open
ateliertoby wants to merge 2 commits into
Open
xds/rbac: skip degenerate empty URI SANs in authenticatedMatcher#9123ateliertoby wants to merge 2 commits into
ateliertoby wants to merge 2 commits into
Conversation
A certificate containing an empty URI SAN (url.URL{}) causes
authenticatedMatcher to treat the URI SAN list as "present" since
len(cert.URIs) > 0, but url.URL{}.String() returns "", producing
a degenerate empty-string identity. This prevents fallthrough to
DNS SANs or Subject, and causes DENY rules using SPIFFE-based
prefix matching to be silently evaded.
This change adds a pre-scan to skip degenerate URI entries before
deciding whether URI SANs constitute a present identity source.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9123 +/- ##
==========================================
- Coverage 83.21% 83.03% -0.18%
==========================================
Files 413 413
Lines 33482 33487 +5
==========================================
- Hits 27863 27807 -56
- Misses 4212 4249 +37
- Partials 1407 1431 +24
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
I have signed the CLA. Please recheck. |
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.
Summary
The
authenticatedMatcherin the xDS RBAC engine treatslen(cert.URIs) > 0as "URI SANs are present". However, a certificate can contain a degenerate empty URI SAN (url.URL{}) whereString()returns"". This satisfies the length check but produces an empty-string identity, which:This PR adds a pre-scan to skip degenerate URI entries before deciding whether URI SANs constitute a present identity source.
Root cause
Commit 94b9449 (#9111) correctly enforces strict identity source precedence per gRFC A41. But the
len(cert.URIs) > 0check does not account for Go'sx509.Certificate.URIscontaining entries like&url.URL{}, whichx509.CreateCertificate()accepts without error.Fix
Before treating URI SANs as "present", scan for at least one entry where
String() != "". If all URI entries are degenerate, fall through to DNS SANs as if no URI SANs existed.Test plan
TestAuthenticatedMatcherEmptyURISANwith 5 cases covering empty URI SAN fallthrough, mixed empty/valid URIs, and no-fallthrough when valid URIs existTestAuthenticatedMatcherIdentitySourcePrecedencetests pass (no regression)RELEASE NOTES:
authenticatedMatcherto skip degenerate empty URI SANs when determining the identity source, preventing silent DENY rule evasion.