(path: string)
| 15 | } |
| 16 | |
| 17 | export function isValidCallbackPath(path: string): boolean { |
| 18 | if ( |
| 19 | path.startsWith('/users/accept-invite') || |
| 20 | path.startsWith('/get-started') || |
| 21 | path.startsWith('/welcome/landing') || |
| 22 | path.startsWith('/organizations/') || |
| 23 | path === '/claw' || |
| 24 | path.startsWith('/claw/') || |
| 25 | path.startsWith('/cloud') || |
| 26 | path === '/subscriptions/kilo-pass' || |
| 27 | path.startsWith('/subscriptions/kilo-pass/') || |
| 28 | path.startsWith('/integrations/') || |
| 29 | // Admin-managed URL bonus campaigns. Stricter shape enforcement |
| 30 | // (slug format, prefix-match guard) happens in |
| 31 | // `isCreditCampaignCallback`; this check only decides whether the |
| 32 | // sign-in redirect is allowed to preserve the path. |
| 33 | path.startsWith('/c/') |
| 34 | ) { |
| 35 | return true; |
| 36 | } |
| 37 | if (isValidIntegrationOAuthConnectCallbackPath(path)) { |
| 38 | return true; |
| 39 | } |
| 40 | return CALLBACK_PATH_REGEX.test(path); |
| 41 | } |
| 42 | |
| 43 | function isValidIntegrationOAuthConnectCallbackPath(path: string): boolean { |
| 44 | if (!path.startsWith('/api/integrations/') || path.startsWith('//')) { |
no test coverage detected