Fix handling of subject alternative names with colons

This commit is contained in:
Michael Lumish 2025-02-21 12:55:09 -08:00
parent 65f4d76f15
commit 7d99c4a7aa
1 changed files with 11 additions and 7 deletions

View File

@ -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) {
@ -137,14 +139,16 @@ class SanEntryMatcher implements ValueMatcher {
}
}
apply(entry: string): boolean {
let [type, value] = entry.split(':');
const colonIndex = entry.indexOf(':');
if (colonIndex < 0) {
return false;
}
const type = entry.substring(0, colonIndex);
let value = entry.substring(colonIndex + 1);
if (!isSupportedSanType(type)) {
return false;
}
value = canonicalizeSanEntryValue(type, value);
if (!entry) {
return false;
}
return this.childMatcher.apply(value);
}
toString(): string {