Skip to content

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

Open
wants to merge 10,000 commits into
base: master
Choose a base branch
from
Open

New Crowdin updates #2879

wants to merge 10,000 commits into from

Conversation

ashkan-deriv
Copy link
Contributor

No description provided.

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
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

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:

  1. Parsing the hostname to ensure it is properly extracted.
  2. Using an explicit whitelist of allowed domains and subdomains.
  3. Checking if the hostname matches any entry in the whitelist.

Suggested changeset 1
public/email/crowdin/translations/ar/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/ar/lp-forex-ebook.html b/public/email/crowdin/translations/ar/lp-forex-ebook.html
--- a/public/email/crowdin/translations/ar/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/ar/lp-forex-ebook.html
@@ -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
EOF
@@ -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
Copilot is powered by AI and may make mistakes. Always verify output.
.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
is reinterpreted as HTML without escaping meta-characters.

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.

Suggested changeset 1
public/email/crowdin/translations/ar/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/ar/lp-forex-ebook.html b/public/email/crowdin/translations/ar/lp-forex-ebook.html
--- a/public/email/crowdin/translations/ar/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/ar/lp-forex-ebook.html
@@ -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)}`
                         }
EOF
@@ -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)}`
}
Copilot is powered by AI and may make mistakes. Always verify output.
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
is reinterpreted as HTML without escaping meta-characters.

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).

Suggested changeset 1
public/email/crowdin/translations/ar/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/ar/lp-forex-ebook.html b/public/email/crowdin/translations/ar/lp-forex-ebook.html
--- a/public/email/crowdin/translations/ar/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/ar/lp-forex-ebook.html
@@ -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)}`
                         }
EOF
@@ -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)}`
}
Copilot is powered by AI and may make mistakes. Always verify output.
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
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

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:

  1. Define a whitelist of allowed hostnames (e.g., ['deriv.com', 'www.deriv.com']).
  2. Parse the hostname using new URL(window.location.href).hostname to extract the actual hostname.
  3. Check if the parsed hostname matches one of the entries in the whitelist.
Suggested changeset 1
public/email/crowdin/translations/bn/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/bn/lp-forex-ebook.html b/public/email/crowdin/translations/bn/lp-forex-ebook.html
--- a/public/email/crowdin/translations/bn/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/bn/lp-forex-ebook.html
@@ -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
EOF
@@ -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
Copilot is powered by AI and may make mistakes. Always verify output.
.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
is reinterpreted as HTML without escaping meta-characters.

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.

Suggested changeset 1
public/email/crowdin/translations/bn/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/bn/lp-forex-ebook.html b/public/email/crowdin/translations/bn/lp-forex-ebook.html
--- a/public/email/crowdin/translations/bn/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/bn/lp-forex-ebook.html
@@ -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)}`
                         }
EOF
@@ -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)}`
}
Copilot is powered by AI and may make mistakes. Always verify output.
.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
is reinterpreted as HTML without escaping meta-characters.

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:

  1. Replace the direct usage of email in the URL construction with encodeURIComponent(email).
  2. Ensure that all instances where email is used in constructing URLs are properly encoded.

Suggested changeset 1
public/email/crowdin/translations/es/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/es/lp-forex-ebook.html b/public/email/crowdin/translations/es/lp-forex-ebook.html
--- a/public/email/crowdin/translations/es/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/es/lp-forex-ebook.html
@@ -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)}`
                         }
EOF
@@ -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)}`
}
Copilot is powered by AI and may make mistakes. Always verify output.
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
is reinterpreted as HTML without escaping meta-characters.

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:

  1. Replace the direct interpolation of email in the URL with encodeURIComponent(email).
  2. Ensure that the emailPattern.test(email) validation remains intact to filter out invalid email formats.

Suggested changeset 1
public/email/crowdin/translations/es/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/es/lp-forex-ebook.html b/public/email/crowdin/translations/es/lp-forex-ebook.html
--- a/public/email/crowdin/translations/es/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/es/lp-forex-ebook.html
@@ -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)}`
                         }
EOF
@@ -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)}`
}
Copilot is powered by AI and may make mistakes. Always verify output.
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
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

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:

  1. Replace the hostname.includes('deriv.com') check with a function that validates the hostname against a whitelist of allowed domains.
  2. Add a helper function to perform this validation.

Suggested changeset 1
public/email/crowdin/translations/fr/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/fr/lp-forex-ebook.html b/public/email/crowdin/translations/fr/lp-forex-ebook.html
--- a/public/email/crowdin/translations/fr/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/fr/lp-forex-ebook.html
@@ -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 = '/'
EOF
@@ -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 = '/'
Copilot is powered by AI and may make mistakes. Always verify output.
.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
is reinterpreted as HTML without escaping meta-characters.

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:

  1. Replace the direct interpolation of email in the URL with a sanitized version using encodeURIComponent.
  2. Ensure that all instances where email is used in URLs are sanitized similarly.
Suggested changeset 1
public/email/crowdin/translations/fr/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/fr/lp-forex-ebook.html b/public/email/crowdin/translations/fr/lp-forex-ebook.html
--- a/public/email/crowdin/translations/fr/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/fr/lp-forex-ebook.html
@@ -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)}`
                         }
EOF
@@ -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)}`
}
Copilot is powered by AI and may make mistakes. Always verify output.
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
is reinterpreted as HTML without escaping meta-characters.

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:

  1. Replacing the direct use of email in the URL with encodeURIComponent(email).
  2. Ensuring that the email value is properly sanitized before being used in the redirection.
Suggested changeset 1
public/email/crowdin/translations/fr/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/fr/lp-forex-ebook.html b/public/email/crowdin/translations/fr/lp-forex-ebook.html
--- a/public/email/crowdin/translations/fr/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/fr/lp-forex-ebook.html
@@ -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)}`
                         }
EOF
@@ -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)}`
}
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link

github-actions bot commented Jul 2, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant