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

Function isAllowedOrigin

apps/local/src/serve-shared.ts:53–57  ·  view source on GitHub ↗
(origin: string, allowed: ReadonlySet<string>)

Source from the content-addressed store, hash-verified

51 * from handing an authenticated cross-origin channel to any web page.
52 */
53export const isAllowedOrigin = (origin: string, allowed: ReadonlySet<string>): boolean => {
54 const hostname = hostnameFromOrigin(origin);
55 if (hostname === null) return false;
56 return allowed.has(hostname) || allowed.has(`[${hostname}]`);
57};
58
59export const hasBearerToken = (request: Request, token: string): boolean => {
60 const authorization = request.headers.get("authorization");

Callers 2

withCorsHeadersFunction · 0.90

Calls 1

hostnameFromOriginFunction · 0.85

Tested by

no test coverage detected