2
0

🔒 Use sanitizeUrl on redirectPath auth param (#1389)

This commit is contained in:
Baptiste Arnaud
2024-03-25 19:11:39 +01:00
committed by GitHub
parent 2bd1cb7562
commit d0be29e257
3 changed files with 12 additions and 1 deletions

View File

@ -13,6 +13,7 @@
"format:check": "prettier --check ./src"
},
"dependencies": {
"@braintree/sanitize-url": "7.0.1",
"@chakra-ui/anatomy": "2.1.1",
"@chakra-ui/react": "2.7.1",
"@chakra-ui/theme-tools": "2.0.18",

View File

@ -28,10 +28,12 @@ import { useToast } from '@/hooks/useToast'
import { TextLink } from '@/components/TextLink'
import { SignInError } from './SignInError'
import { useTranslate } from '@tolgee/react'
import { sanitizeUrl } from '@braintree/sanitize-url'
type Props = {
defaultEmail?: string
}
export const SignInForm = ({
defaultEmail,
}: Props & HTMLChakraProps<'form'>) => {
@ -55,7 +57,8 @@ export const SignInForm = ({
useEffect(() => {
if (status === 'authenticated') {
router.replace(router.query.redirectPath?.toString() ?? '/typebots')
const redirectPath = router.query.redirectPath?.toString()
router.replace(redirectPath ? sanitizeUrl(redirectPath) : '/typebots')
return
}
;(async () => {