mirror of
https://github.com/logseq/logseq.git
synced 2026-05-05 19:36:35 +00:00
chore: replace re-find with safe-re-find
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
(ns frontend.security
|
||||
(:require [clojure.walk :as walk]))
|
||||
(:require [clojure.walk :as walk]
|
||||
[frontend.util :as util]))
|
||||
|
||||
;; To prevent from cross-site scripting vulnerability, we should add security checks for both hiccup and raw html.
|
||||
;; Hiccup: [:a {:href "javascript:alert('hei')"} "click me"]
|
||||
@@ -11,7 +12,7 @@
|
||||
(= :a (first f))
|
||||
(:href (second f))
|
||||
(:href (second f))
|
||||
(re-find #"(?i)javascript" (:href (second f)))))
|
||||
(util/safe-re-find #"(?i)javascript" (:href (second f)))))
|
||||
|
||||
(defn remove-javascript-links-in-href
|
||||
[hiccup]
|
||||
|
||||
Reference in New Issue
Block a user