case 4721 - client escaping of record text
Record text shown as HTML is escaped: unit warranty summary (vendor name, receipt number), work-order address dialog (now plain text), search excerpt (escaped, search terms highlighted as plain text, not as a regular expression). Confirmation dialog messages are sanitised with DOMPurify. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,10 +31,7 @@
|
||||
<span v-if="options.title" class="ml-5"> {{ options.title }} </span>
|
||||
</v-card-title>
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<v-card-text
|
||||
class="text-body-1 text-sm-h6 my-5"
|
||||
v-html="options.message"
|
||||
>
|
||||
<v-card-text class="text-body-1 text-sm-h6 my-5" v-html="safeMessage">
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
@@ -82,6 +79,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import DOMPurify from "dompurify";
|
||||
export default {
|
||||
data: () => ({
|
||||
width: 290,
|
||||
@@ -97,6 +95,12 @@ export default {
|
||||
type: "info" //one of success, info, question, warning, and error, see v-alert docs for more info
|
||||
}
|
||||
}),
|
||||
computed: {
|
||||
//case 4721: messages can hold formatting (line breaks), but never script: sanitised before it is shown
|
||||
safeMessage() {
|
||||
return DOMPurify.sanitize(this.options.message || "");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(options) {
|
||||
if (options.message.includes("\n")) {
|
||||
|
||||
Reference in New Issue
Block a user