-
Notifications
You must be signed in to change notification settings - Fork 211
[PROD] - UTM register btn #7167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
PM-2524 Fix empty submissions tab for DS F2F
| if (!auth.tokenV3) { | ||
| const utmSource = communityId || 'community-app-main'; | ||
| window.location.href = `${config.URL.AUTH}/member?retUrl=${encodeURIComponent(`${window.location.origin}${window.location.pathname}`)}&utm_source=${utmSource}®Source=challenges`; | ||
| window.location.href = appendUtmParamsToUrl( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗ security]
The appendUtmParamsToUrl function is used to construct a URL with query parameters. Ensure that this function properly encodes all URL components to prevent potential security issues such as URL injection.
|
|
||
| // handle values that might contain '=' | ||
| const cookieValue = decodeURIComponent(cookieStr.split('=').slice(1).join('=')); | ||
| return JSON.parse(cookieValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[maintainability]
Consider logging the error or handling it in a way that provides more context. Swallowing errors silently can make debugging difficult.
|
|
||
| return urlObj.toString(); | ||
| } catch (error) { | ||
| return url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[maintainability]
Consider logging the error or handling it in a way that provides more context. Swallowing errors silently can make debugging difficult.
| * @param url - The base URL to append parameters to | ||
| * @returns URL with UTM parameters appended, or original URL if no cookie exists | ||
| */ | ||
| export function appendUtmParamsToUrl(url, defaultParams = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[correctness]
The function appendUtmParamsToUrl should validate the url parameter more robustly. Currently, it only checks for falsy values, but malformed URLs could still cause issues.
|
@kkartunov let's close this one |
https://topcoder.atlassian.net/browse/PM-3204