(origin: string)
| 36 | }; |
| 37 | |
| 38 | const hostnameFromOrigin = (origin: string): string | null => { |
| 39 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: parsing an untrusted Origin header that may be malformed |
| 40 | try { |
| 41 | return new URL(origin).hostname; |
| 42 | } catch { |
| 43 | return null; |
| 44 | } |
| 45 | }; |
| 46 | |
| 47 | /** |
| 48 | * Whether a cross-origin request's `Origin` is allowed CORS access. Only the |