Skip to content

Commit

Permalink
Fix handling of subject alternative names with colons
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Feb 21, 2025
1 parent 65f4d76 commit 7d99c4a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/grpc-js-xds/src/load-balancer-cds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ class DnsExactValueMatcher implements ValueMatcher {
}
}
apply(entry: string): boolean {
let [type, value] = entry.split(':');
if (!isSupportedSanType(type)) {
const colonIndex = entry.indexOf(':');
if (colonIndex < 0) {
return false;
}
if (!value) {
const type = entry.substring(0, colonIndex);
let value = entry.substring(colonIndex + 1);
if (!isSupportedSanType(type)) {
return false;
}
if (this.ignoreCase) {
Expand Down Expand Up @@ -137,14 +139,16 @@ class SanEntryMatcher implements ValueMatcher {
}
}
apply(entry: string): boolean {
let [type, value] = entry.split(':');
if (!isSupportedSanType(type)) {
const colonIndex = entry.indexOf(':');
if (colonIndex < 0) {
return false;
}
value = canonicalizeSanEntryValue(type, value);
if (!entry) {
const type = entry.substring(0, colonIndex);
let value = entry.substring(colonIndex + 1);
if (!isSupportedSanType(type)) {
return false;
}
value = canonicalizeSanEntryValue(type, value);
return this.childMatcher.apply(value);
}
toString(): string {
Expand Down

0 comments on commit 7d99c4a

Please sign in to comment.