MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / hostnameFromOrigin

Function hostnameFromOrigin

apps/local/src/serve-shared.ts:38–45  ·  view source on GitHub ↗
(origin: string)

Source from the content-addressed store, hash-verified

36};
37
38const 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

Callers 1

isAllowedOriginFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected