We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 507fb22 commit 527cfb3Copy full SHA for 527cfb3
1 file changed
packages/core/src/validators/externalRefResolver.ts
@@ -115,8 +115,17 @@ function ipv6LiteralFromHost(host: string): string | undefined {
115
return host.startsWith('[') && host.endsWith(']') ? host.slice(1, -1) : undefined;
116
}
117
118
+function stripTrailingDnsRootDots(host: string): string {
119
+ let end = host.length;
120
+ while (end > 0 && host.codePointAt(end - 1) === 46) {
121
+ end--;
122
+ }
123
+
124
+ return end === host.length ? host : host.slice(0, end);
125
+}
126
127
function normalizeHostForPolicy(host: string): string {
- return ipv6LiteralFromHost(host) === undefined ? host.replace(/\.+$/, '') : host;
128
+ return ipv6LiteralFromHost(host) === undefined ? stripTrailingDnsRootDots(host) : host;
129
130
131
function isBlockedIPv6Literal(host: string): boolean {
0 commit comments