Install using bunx shadcn@latest add @remix-utils/safe-redirect.
When performing a redirect, if the URL is user provided we can't trust it, if you do you're opening a vulnerability to phishing scam by allowing bad actors to redirect the user to malicious websites.
The second argumento of safeRedirect is the default redirect which by when not configured is /, this lets you tell safeRedirect where to redirect the user if the value is not safe.
Install using
bunx shadcn@latest add @remix-utils/safe-redirect.When performing a redirect, if the URL is user provided we can't trust it, if you do you're opening a vulnerability to phishing scam by allowing bad actors to redirect the user to malicious websites.
To help you prevent this Remix Utils gives you a
safeRedirectfunction which can be used to check if the URL is "safe".In this context, safe means the URL starts with
/but not//, this means the URL is a pathname inside the same app and not an external link.The second argumento of
safeRedirectis the default redirect which by when not configured is/, this lets you tellsafeRedirectwhere to redirect the user if the value is not safe.Author
Sergio XalambrÃ