MCPcopy Index your code
hub / github.com/simstudioai/sim / assertSafeOauthServerUrl

Function assertSafeOauthServerUrl

apps/sim/lib/mcp/oauth/url-validation.ts:14–25  ·  view source on GitHub ↗
(rawUrl: string | null | undefined)

Source from the content-addressed store, hash-verified

12 * http allowed only for loopback addresses during local development.
13 */
14export function assertSafeOauthServerUrl(rawUrl: string | null | undefined): URL {
15 if (!rawUrl) throw new McpOauthInsecureUrlError(String(rawUrl))
16 let parsed: URL
17 try {
18 parsed = new URL(rawUrl)
19 } catch {
20 throw new McpOauthInsecureUrlError(rawUrl)
21 }
22 if (parsed.protocol === 'https:') return parsed
23 if (parsed.protocol === 'http:' && isLoopbackHostname(parsed.hostname)) return parsed
24 throw new McpOauthInsecureUrlError(rawUrl)
25}

Callers 2

route.tsFile · 0.90
route.tsFile · 0.90

Calls 1

isLoopbackHostnameFunction · 0.90

Tested by

no test coverage detected