adminforth 4.12.2 → 4.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
6
|
import type { AdminForthResourceColumnCommon, AdminForthResourceFrontend, AdminUser } from '@/types/Common'
|
|
7
|
-
import { protectAgainstXSS } from '@/utils'
|
|
7
|
+
import { protectAgainstXSS } from '@/utils/protectAgainstXSS'
|
|
8
8
|
|
|
9
9
|
const props = defineProps<{
|
|
10
10
|
column: AdminForthResourceColumnCommon
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
6
|
import { nextTick, onMounted, ref, watch } from 'vue'
|
|
7
7
|
import type { AdminForthResourceColumnCommon, AdminForthResourceFrontend, AdminUser } from '@/types/Common'
|
|
8
|
-
import { protectAgainstXSS } from '@/utils'
|
|
8
|
+
import { protectAgainstXSS } from '@/utils/protectAgainstXSS'
|
|
9
9
|
|
|
10
10
|
const props = defineProps<{
|
|
11
11
|
column: AdminForthResourceColumnCommon
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import DOMPurify from 'dompurify';
|
|
2
|
+
|
|
3
|
+
// only the rich text renderers import this module, so dompurify lands in their lazy chunks; re-exporting it from
|
|
4
|
+
// utils/index.ts would put dompurify back into the first screen, it runs code when its module loads
|
|
5
|
+
export function protectAgainstXSS(value: string) {
|
|
6
|
+
return DOMPurify.sanitize(value, {
|
|
7
|
+
ALLOWED_TAGS: [
|
|
8
|
+
"address","article","aside","footer","header","h1","h2","h3","h4",
|
|
9
|
+
"h5","h6","hgroup","main","nav","section","blockquote","dd","div",
|
|
10
|
+
"dl","dt","figcaption","figure","hr","li","ol","p","pre",
|
|
11
|
+
"ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn",
|
|
12
|
+
"em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp",
|
|
13
|
+
"small","span","strong","sub","sup","time","u","var","wbr","caption",
|
|
14
|
+
"col","colgroup","table","tbody","td","tfoot","th","thead","tr",
|
|
15
|
+
"img","video","source"
|
|
16
|
+
],
|
|
17
|
+
ALLOWED_ATTR: [
|
|
18
|
+
"data-list",
|
|
19
|
+
"src","srcset","alt","title","width","height","loading",
|
|
20
|
+
"controls","autoplay","loop","muted","poster","playsinline","type",
|
|
21
|
+
"class","style"
|
|
22
|
+
],
|
|
23
|
+
ALLOW_DATA_ATTR: true,
|
|
24
|
+
ALLOW_ARIA_ATTR: true
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -5,7 +5,6 @@ import router from "../router";
|
|
|
5
5
|
import { useCoreStore } from '../stores/core';
|
|
6
6
|
import { useUserStore } from '../stores/user';
|
|
7
7
|
import adminforth, { useAdminforth } from '../adminforth';
|
|
8
|
-
import DOMPurify from 'dompurify'
|
|
9
8
|
import debounce from 'debounce';
|
|
10
9
|
import type { AdminForthActionFront, AdminForthResourceColumnInputCommon, AdminForthResourceFrontend, Predicate } from '@/types/Common';
|
|
11
10
|
import { i18nInstance } from '../i18n'
|
|
@@ -336,28 +335,6 @@ export function verySimpleHash(str: string): string {
|
|
|
336
335
|
|
|
337
336
|
export { humanifySize } from '../afcl/fileSize';
|
|
338
337
|
|
|
339
|
-
export function protectAgainstXSS(value: string) {
|
|
340
|
-
return DOMPurify.sanitize(value, {
|
|
341
|
-
ALLOWED_TAGS: [
|
|
342
|
-
"address","article","aside","footer","header","h1","h2","h3","h4",
|
|
343
|
-
"h5","h6","hgroup","main","nav","section","blockquote","dd","div",
|
|
344
|
-
"dl","dt","figcaption","figure","hr","li","ol","p","pre",
|
|
345
|
-
"ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn",
|
|
346
|
-
"em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp",
|
|
347
|
-
"small","span","strong","sub","sup","time","u","var","wbr","caption",
|
|
348
|
-
"col","colgroup","table","tbody","td","tfoot","th","thead","tr",
|
|
349
|
-
"img","video","source"
|
|
350
|
-
],
|
|
351
|
-
ALLOWED_ATTR: [
|
|
352
|
-
"data-list",
|
|
353
|
-
"src","srcset","alt","title","width","height","loading",
|
|
354
|
-
"controls","autoplay","loop","muted","poster","playsinline","type",
|
|
355
|
-
"class","style"
|
|
356
|
-
],
|
|
357
|
-
ALLOW_DATA_ATTR: true,
|
|
358
|
-
ALLOW_ARIA_ATTR: true
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
338
|
|
|
362
339
|
export function isPolymorphicColumn(column: any): boolean {
|
|
363
340
|
return !!(column.foreignResource?.polymorphicResources && column.foreignResource.polymorphicResources.length > 0);
|