(path: string)
| 16 | const isOAuthCallbackReturnTo = (path: string): boolean => pathPart(path) === "/api/oauth/callback"; |
| 17 | |
| 18 | export 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. */ |
| 24 | export const safeReturnTo = (path: string | null | undefined): string | null => |
no test coverage detected