Sanitizes a few snackbar messages for safety.

This commit is contained in:
mateuswetah 2023-11-17 17:11:45 -03:00
parent c9c0e0db2a
commit 14898b962f
3 changed files with 5 additions and 5 deletions

View File

@ -751,7 +751,7 @@ export default {
let errorMessage = errors.length > 1 ? this.$i18n.getWithVariables('info_terms_creation_failed_due_to_values_%s', [ wrongValues ]) : this.$i18n.getWithVariables('info_terms_creation_failed_due_to_value_%s', [ wrongValues ]); let errorMessage = errors.length > 1 ? this.$i18n.getWithVariables('info_terms_creation_failed_due_to_values_%s', [ wrongValues ]) : this.$i18n.getWithVariables('info_terms_creation_failed_due_to_value_%s', [ wrongValues ]);
errorMessage += ' ' + errors[0]['errors'][0]['name']; errorMessage += ' ' + errors[0]['errors'][0]['name'];
this.$buefy.snackbar.open({ this.$buefy.snackbar.open({
message: errorMessage, message: errorMessage.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/\//g, '&#x2F;'),
type: 'is-danger', type: 'is-danger',
position: 'is-bottom-right', position: 'is-bottom-right',
pauseOnHover: true, pauseOnHover: true,

View File

@ -15,7 +15,7 @@ ConsolePlugin.install = function (Vue, options = { visual: false }) {
log(something) { log(something) {
if (options.visual) { if (options.visual) {
Vue.prototype.$buefy.snackbar.open({ Vue.prototype.$buefy.snackbar.open({
message: something, message: something.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/\//g, '&#x2F;'),
type: 'is-secondary', type: 'is-secondary',
position: 'is-bottom-right', position: 'is-bottom-right',
indefinite: true, indefinite: true,
@ -28,7 +28,7 @@ ConsolePlugin.install = function (Vue, options = { visual: false }) {
info(someInfo) { info(someInfo) {
if (options.visual) { if (options.visual) {
Vue.prototype.$buefy.snackbar.open({ Vue.prototype.$buefy.snackbar.open({
message: someInfo, message: someInfo.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/\//g, '&#x2F;'),
type: 'is-primary', type: 'is-primary',
position: 'is-bottom-right', position: 'is-bottom-right',
duration: 5000, duration: 5000,
@ -41,7 +41,7 @@ ConsolePlugin.install = function (Vue, options = { visual: false }) {
error(someError) { error(someError) {
if (options.visual) { if (options.visual) {
Vue.prototype.$buefy.snackbar.open({ Vue.prototype.$buefy.snackbar.open({
message: someError, message: someError.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/\//g, '&#x2F;'),
type: 'is-danger', type: 'is-danger',
position: 'is-bottom-right', position: 'is-bottom-right',
indefinite: true, indefinite: true,

View File

@ -37,7 +37,7 @@ export const tainacanErrorHandler = function(error) {
break; break;
} }
Snackbar.open({ Snackbar.open({
message: errorMessage, message: errorMessage.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/\//g, '&#x2F;'),
type: 'is-danger', type: 'is-danger',
duration: duration, duration: duration,
actionText: errorMessageDetail != '' ? i18nGet('label_know_more') : null, actionText: errorMessageDetail != '' ? i18nGet('label_know_more') : null,