mirror of
https://github.com/bitwarden/browser
synced 2026-01-30 08:13:44 +00:00
ts-strict: Fix possibly null on parsedOrigin.hostname
This commit is contained in:
@@ -48,7 +48,12 @@ export function isValidRpId(rpId: string, origin: string) {
|
||||
if (rpId !== "localhost" && !rpId.includes(".")) {
|
||||
return false;
|
||||
}
|
||||
if (parsedOrigin.hostname !== "localhost" && !parsedOrigin.hostname.includes(".")) {
|
||||
|
||||
if (
|
||||
parsedOrigin.hostname != null &&
|
||||
parsedOrigin.hostname !== "localhost" &&
|
||||
!parsedOrigin.hostname.includes(".")
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,7 +70,7 @@ export function isValidRpId(rpId: string, origin: string) {
|
||||
|
||||
// Check if origin is a subdomain of rpId
|
||||
// This prevents "evilaccounts.example.com" from matching "accounts.example.com"
|
||||
if (parsedOrigin.hostname.endsWith("." + rpId)) {
|
||||
if (parsedOrigin.hostname != null && parsedOrigin.hostname.endsWith("." + rpId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user