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

Function isSafeReturnTo

apps/cloud/src/auth/return-to.ts:18–21  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

16const isOAuthCallbackReturnTo = (path: string): boolean => pathPart(path) === "/api/oauth/callback";
17
18export const isSafeReturnTo = (path: string): boolean =>
19 path.startsWith("/") &&
20 !path.startsWith("//") &&
21 (!/^\/api(\/|$)/.test(path) || isOAuthCallbackReturnTo(path));
22
23/** The validated returnTo, or null when absent/unsafe. */
24export const safeReturnTo = (path: string | null | undefined): string | null =>

Callers 2

return-to.test.tsFile · 0.90
safeReturnToFunction · 0.70

Calls 1

isOAuthCallbackReturnToFunction · 0.70

Tested by

no test coverage detected