Browse Source

chore: add sanitization options

Konstantinos Kaloutas 3 years ago
parent
commit
56584121e6
1 changed files with 10 additions and 1 deletions
  1. 10 1
      src/main/frontend/security.cljs

+ 10 - 1
src/main/frontend/security.cljs

@@ -25,9 +25,18 @@
        f))
    hiccup))
 
+(def sanitization-options (clj->js {:ADD_TAGS ["iframe"]
+                                    :ALLOW_UNKNOWN_PROTOCOLS true
+                                    :ADD_ATTR ["allow"
+                                               "src"
+                                               "allowfullscreen"
+                                               "frameborder"
+                                               "scrolling"
+                                               "target"]}))
+
 (defn sanitize-html
   [html]
-  (.sanitize DOMPurify html))
+  (.sanitize DOMPurify html sanitization-options))
 
 ;; HTML:
 ;; Example 1: