Skip to content

Commit 8237014

Browse files
Sanitize input to apexchart (#5709)
1 parent fd590d3 commit 8237014

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/dispatch/static/dispatch/src/dashboard/DashboardCard.vue

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<template>
22
<v-card variant="outlined" :loading="loading">
33
<v-card-title>{{ title }}</v-card-title>
4-
<apexchart :type="type" height="250" :options="localOptions" :series="series" />
4+
<apexchart :type="type" height="250" :options="localOptions" :series="sanitize(series)" />
55
</v-card>
66
</template>
77

88
<script>
99
import VueApexCharts from "vue3-apexcharts"
10+
import DOMPurify from "dompurify"
11+
1012
export default {
1113
name: "DashboardCard",
1214
@@ -40,7 +42,13 @@ export default {
4042
required: true,
4143
},
4244
},
43-
45+
methods: {
46+
sanitize(series) {
47+
return series.map((s) => {
48+
return { name: DOMPurify.sanitize(s.name), data: s.data }
49+
})
50+
},
51+
},
4452
data() {
4553
return {
4654
localOptions: JSON.parse(JSON.stringify(this.options)),

0 commit comments

Comments
 (0)