Skip to content

Commit

Permalink
refactor: redirect only if proper log link
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrishimeena committed Oct 18, 2024
1 parent f6f5442 commit dc14ee5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/web/src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ class Login extends React.Component {
const hashFragment = window.location.hash.split('?')[1];
const hashParams = new URLSearchParams(hashFragment);
const redirectUrl = hashParams.get('redirect') || null;
if (redirectUrl) {
const logsPathRegex = /^#\/logs\?errsole_log_id=[^&]+/;
const shouldRedirect = logsPathRegex.test(redirectUrl);
if (redirectUrl && shouldRedirect) {
// Decode the redirect URL
const decodedUrl = decodeURIComponent(redirectUrl);
// Validate that the decoded URL is a relative path starting with '#/'
Expand Down

0 comments on commit dc14ee5

Please sign in to comment.