-
Notifications
You must be signed in to change notification settings - Fork 66
New Crowdin updates #2879
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?
New Crowdin updates #2879
Conversation
var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage | ||
var CookieStorage = function (cookie_name, cookie_domain = '') { | ||
var hostname = window.location.hostname | ||
var is_deriv_com = hostname.includes('deriv.com') |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
deriv.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, we need to replace the substring check hostname.includes('deriv.com')
with a more secure method of validating the hostname. Specifically, we should compare the hostname against a whitelist of allowed domains or subdomains. This ensures that only legitimate domains like deriv.com
or its subdomains (e.g., www.deriv.com
, beta.deriv.com
) are accepted.
The fix involves:
- Parsing the
hostname
to ensure it is properly extracted. - Using an explicit whitelist of allowed domains and subdomains.
- Checking if the
hostname
matches any entry in the whitelist.
-
Copy modified lines R492-R493
@@ -491,3 +491,4 @@ | ||
var hostname = window.location.hostname | ||
var is_deriv_com = hostname.includes('deriv.com') | ||
var allowedDomains = ['deriv.com', 'www.deriv.com', 'beta.deriv.com']; | ||
var is_deriv_com = allowedDomains.includes(hostname); | ||
this.initialized = false |
.socketMessageSend(JSON.stringify(data), 'verify_email') | ||
.then(res => { | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, the email
value should be sanitized or encoded before being interpolated into the URL string. Specifically, the encodeURIComponent
function should be used to encode the email
value. This function ensures that special characters in the email address are properly escaped, preventing them from being interpreted as part of the URL or as executable code.
The changes should be made on line 1578 and line 1580, where the email
value is interpolated into the URL. The encodeURIComponent
function will be applied to the email
variable in both cases.
-
Copy modified line R1578 -
Copy modified line R1580
@@ -1577,5 +1577,5 @@ | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
window.location.href = `/${language}/verify-email?email=${encodeURIComponent(email)}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` | ||
window.location.href = `/verify-email?email=${encodeURIComponent(email)}` | ||
} |
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, the email
variable should be sanitized or encoded before being interpolated into the URL. The best approach is to use encodeURIComponent
, which ensures that special characters in the email are properly escaped, preventing them from being interpreted as part of the HTML or JavaScript. This change should be applied to the interpolation on line 1580 (and line 1578 for consistency).
-
Copy modified line R1578 -
Copy modified line R1580
@@ -1577,5 +1577,5 @@ | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
window.location.href = `/${language}/verify-email?email=${encodeURIComponent(email)}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` | ||
window.location.href = `/verify-email?email=${encodeURIComponent(email)}` | ||
} |
var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage | ||
var CookieStorage = function (cookie_name, cookie_domain = '') { | ||
var hostname = window.location.hostname | ||
var is_deriv_com = hostname.includes('deriv.com') |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
deriv.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, replace the substring check hostname.includes('deriv.com')
with a more secure validation method. Specifically, parse the hostname and compare it against a whitelist of allowed hostnames or use exact matching to ensure that only legitimate hostnames are accepted.
Steps to implement the fix:
- Define a whitelist of allowed hostnames (e.g.,
['deriv.com', 'www.deriv.com']
). - Parse the hostname using
new URL(window.location.href).hostname
to extract the actual hostname. - Check if the parsed hostname matches one of the entries in the whitelist.
-
Copy modified lines R491-R493
@@ -490,4 +490,5 @@ | ||
var CookieStorage = function (cookie_name, cookie_domain = '') { | ||
var hostname = window.location.hostname | ||
var is_deriv_com = hostname.includes('deriv.com') | ||
var hostname = new URL(window.location.href).hostname | ||
var allowedHostnames = ['deriv.com', 'www.deriv.com'] | ||
var is_deriv_com = allowedHostnames.includes(hostname) | ||
this.initialized = false |
.socketMessageSend(JSON.stringify(data), 'verify_email') | ||
.then(res => { | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, the email
variable should be sanitized or encoded before being embedded in the URL. Specifically, the encodeURIComponent
function should be used to encode the email
value, ensuring that any special characters or potentially malicious input are safely escaped. This change should be applied to the construction of the URL on line 1578.
-
Copy modified line R1578 -
Copy modified line R1580
@@ -1577,5 +1577,5 @@ | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
window.location.href = `/${language}/verify-email?email=${encodeURIComponent(email)}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` | ||
window.location.href = `/verify-email?email=${encodeURIComponent(email)}` | ||
} |
.socketMessageSend(JSON.stringify(data), 'verify_email') | ||
.then(res => { | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, the email
value should be properly encoded before being used in the URL. This can be achieved using encodeURIComponent
, which ensures that special characters in the email value are safely escaped. This prevents any malicious input from being interpreted as HTML or JavaScript.
Steps to fix:
- Replace the direct usage of
email
in the URL construction withencodeURIComponent(email)
. - Ensure that all instances where
email
is used in constructing URLs are properly encoded.
-
Copy modified line R1578 -
Copy modified line R1580
@@ -1577,5 +1577,5 @@ | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
window.location.href = `/${language}/verify-email?email=${encodeURIComponent(email)}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` | ||
window.location.href = `/verify-email?email=${encodeURIComponent(email)}` | ||
} |
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, the email
value should be sanitized or encoded before being used in the URL. The best approach is to use encodeURIComponent
, which ensures that special characters in the email
value are properly escaped, preventing them from being interpreted as HTML or causing other security issues.
Steps to fix:
- Replace the direct interpolation of
email
in the URL withencodeURIComponent(email)
. - Ensure that the
emailPattern.test(email)
validation remains intact to filter out invalid email formats.
-
Copy modified line R1578 -
Copy modified line R1580
@@ -1577,5 +1577,5 @@ | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
window.location.href = `/${language}/verify-email?email=${encodeURIComponent(email)}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` | ||
window.location.href = `/verify-email?email=${encodeURIComponent(email)}` | ||
} |
var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage | ||
var CookieStorage = function (cookie_name, cookie_domain = '') { | ||
var hostname = window.location.hostname | ||
var is_deriv_com = hostname.includes('deriv.com') |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
deriv.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, we need to replace the substring check hostname.includes('deriv.com')
with a more secure method that ensures the hostname is exactly deriv.com
or one of its subdomains. This can be achieved by parsing the hostname and verifying it against a whitelist of allowed domains. The endsWith
method can be used to ensure that the hostname ends with .deriv.com
or is exactly deriv.com
.
Changes to be made:
- Replace the
hostname.includes('deriv.com')
check with a function that validates the hostname against a whitelist of allowed domains. - Add a helper function to perform this validation.
-
Copy modified lines R491-R494 -
Copy modified line R496 -
Copy modified line R499
@@ -490,7 +490,11 @@ | ||
var CookieStorage = function (cookie_name, cookie_domain = '') { | ||
function isAllowedDomain(hostname) { | ||
const allowedDomains = ['deriv.com']; | ||
return allowedDomains.some(domain => hostname === domain || hostname.endsWith(`.${domain}`)); | ||
} | ||
var hostname = window.location.hostname | ||
var is_deriv_com = hostname.includes('deriv.com') | ||
var is_deriv_com = isAllowedDomain(hostname) | ||
this.initialized = false | ||
this.cookie_name = cookie_name | ||
this.domain = is_deriv_com ? deriv_cookie_domain : cookie_domain || hostname | ||
this.domain = is_deriv_com ? deriv_cookie_domain : (cookie_domain || hostname) | ||
this.path = '/' |
.socketMessageSend(JSON.stringify(data), 'verify_email') | ||
.then(res => { | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, the user input (emailInput?.value
) must be sanitized or encoded before being used in the URL. The best approach is to use a function that performs contextual output encoding, such as encodeURIComponent
, which ensures that special characters in the email value are properly escaped. This prevents the input from being interpreted as HTML or JavaScript.
Steps to fix:
- Replace the direct interpolation of
email
in the URL with a sanitized version usingencodeURIComponent
. - Ensure that all instances where
email
is used in URLs are sanitized similarly.
-
Copy modified line R1578 -
Copy modified line R1580
@@ -1577,5 +1577,5 @@ | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
window.location.href = `/${language}/verify-email?email=${encodeURIComponent(email)}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` | ||
window.location.href = `/verify-email?email=${encodeURIComponent(email)}` | ||
} |
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 days ago
To fix the issue, the email
variable should be sanitized or encoded before being interpolated into the URL. Specifically, the email value should be URL-encoded to ensure that any special characters are safely represented in the query string. This can be achieved using JavaScript's encodeURIComponent
function, which encodes a string as a valid URI component.
The fix involves:
- Replacing the direct use of
email
in the URL withencodeURIComponent(email)
. - Ensuring that the
email
value is properly sanitized before being used in the redirection.
-
Copy modified line R1578 -
Copy modified line R1580
@@ -1577,5 +1577,5 @@ | ||
if (language && language !== 'en') { | ||
window.location.href = `/${language}/verify-email?email=${email}` | ||
window.location.href = `/${language}/verify-email?email=${encodeURIComponent(email)}` | ||
} else { | ||
window.location.href = `/verify-email?email=${email}` | ||
window.location.href = `/verify-email?email=${encodeURIComponent(email)}` | ||
} |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Manifest Files |
No description provided.