From ecfbc44a204e34c57ece25b76ba1ba8f6e507a9d Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Sun, 28 Apr 2024 16:02:54 -0700 Subject: [PATCH] safely escape settings strings --- src/UI/Settings/UITabAbout.js | 2 +- src/UI/Settings/UITabAccount.js | 5 ++--- src/UI/Settings/UITabLanguage.js | 2 +- src/UI/Settings/UITabUsage.js | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/UI/Settings/UITabAbout.js b/src/UI/Settings/UITabAbout.js index f2842bc8..c8346e43 100644 --- a/src/UI/Settings/UITabAbout.js +++ b/src/UI/Settings/UITabAbout.js @@ -96,7 +96,7 @@ export default { puter.os.version() .then(res => { const deployed_date = new Date(res.deploy_timestamp).toLocaleString(); - $el_window.find('.version').html(`Version: ${html_encode(res.version)} • Server: ${html_encode(res.location)} • Deployed: ${deployed_date}`); + $el_window.find('.version').html(`Version: ${html_encode(res.version)} • Server: ${html_encode(res.location)} • Deployed: ${html_encode(deployed_date)}`); }) .catch(error => { console.error("Failed to fetch server info:", error); diff --git a/src/UI/Settings/UITabAccount.js b/src/UI/Settings/UITabAccount.js index 18d68cbc..4ed08ea0 100644 --- a/src/UI/Settings/UITabAccount.js +++ b/src/UI/Settings/UITabAccount.js @@ -44,7 +44,7 @@ export default { h += `
`; h += `
`; h += `${i18n('username')}`; - h += `${user.username}`; + h += `${html_encode(user.username)}`; h += `
`; h += `
`; h += ``; @@ -56,7 +56,7 @@ export default { h += `
`; h += `
`; h += `${i18n('email')}`; - h += `${user.email}`; + h += `${html_encode(user.email)}`; h += `
`; h += `
`; h += ``; @@ -104,7 +104,6 @@ export default { }); $el_window.find('.change-email').on('click', function (e) { - console.log('change email', $el_window.attr('data-element_uuid')); UIWindowChangeEmail({ window_options:{ parent_uuid: $el_window.attr('data-element_uuid'), diff --git a/src/UI/Settings/UITabLanguage.js b/src/UI/Settings/UITabLanguage.js index 361cdb74..5bb09a68 100644 --- a/src/UI/Settings/UITabLanguage.js +++ b/src/UI/Settings/UITabLanguage.js @@ -35,7 +35,7 @@ export default { const available_languages = listSupportedLanguages(); h += `
`; for (let lang of available_languages) { - h += `
${lang.name}
`; + h += `
${html_encode(lang.name)}
`; } h += `
`; return h; diff --git a/src/UI/Settings/UITabUsage.js b/src/UI/Settings/UITabUsage.js index 88f15b6f..976475cf 100644 --- a/src/UI/Settings/UITabUsage.js +++ b/src/UI/Settings/UITabUsage.js @@ -67,7 +67,7 @@ export default { usage_percentage = usage_percentage > 100 ? 100 : usage_percentage; // Cap at 100% usageDisplay = `
-

${service.service['driver.interface']} (${service.service['driver.method']}):

+

${html_encode(service.service['driver.interface'])} (${html_encode(service.service['driver.method'])}):

${monthly_usage} used of ${monthly_limit}
${usage_percentage}%
@@ -78,7 +78,7 @@ export default { else { usageDisplay = `
-

${service.service['driver.interface']} (${service.service['driver.method']}):

+

${html_encode(service.service['driver.interface'])} (${html_encode(service.service['driver.method'])}):

${i18n('usage')}: ${monthly_usage} (${i18n('unlimited')})
`;