0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-26 00:19:07 -05:00

🐛 Fix tab reuse issue (viewer <-> workspace).

This commit is contained in:
Andrey Antukh 2021-11-15 16:22:31 +01:00 committed by Andrés Moya
parent 6eac9102c9
commit abca69f408
2 changed files with 8 additions and 5 deletions

View file

@ -411,13 +411,15 @@
(let [event (.-nativeEvent ^js bevent)] (let [event (.-nativeEvent ^js bevent)]
(= 1 (.-which event)))) (= 1 (.-which event))))
;; Warning: need to protect against reverse tabnabbing attack
;; https://www.comparitech.com/blog/information-security/reverse-tabnabbing/
(defn open-new-window (defn open-new-window
([uri] ([uri]
(open-new-window uri "_blank")) (open-new-window uri "_blank" "noopener,noreferrer"))
([uri name] ([uri name]
;; Warning: need to protect against reverse tabnabbing attack (open-new-window uri name "noopener,noreferrer"))
;; https://www.comparitech.com/blog/information-security/reverse-tabnabbing/ ([uri name features]
(.open js/window (str uri) name "noopener,noreferrer"))) (.open js/window (str uri) name features)))
(defn browser-back (defn browser-back
[] []

View file

@ -117,9 +117,10 @@
(effect [_ state _] (effect [_ state _]
(let [router (:router state) (let [router (:router state)
path (resolve router rname path-params query-params) path (resolve router rname path-params query-params)
name (or name "_blank")
uri (-> (u/uri cfg/public-uri) uri (-> (u/uri cfg/public-uri)
(assoc :fragment path))] (assoc :fragment path))]
(dom/open-new-window (str uri) name))))) (dom/open-new-window uri name nil)))))
(defn nav-back (defn nav-back
[] []