Skip to content

A platform for community discussion. Free, open, simple.

SECURITY: Fix tab nabbing.

Dan Ungureanu3aa143a52c22
diff --git a/app/assets/javascripts/discourse/lib/click-track.js.es6 b/app/assets/javascripts/discourse/lib/click-track.js.es6
index 52b1b7897f7..d4d0e71f2ee 100644
--- a/app/assets/javascripts/discourse/lib/click-track.js.es6
+++ b/app/assets/javascripts/discourse/lib/click-track.js.es6
@@ -108,7 +108,9 @@ export default {
if (!wantsNewWindow(e)) {
if (!isInternal && openExternalInNewTab) {
- window.open(href, "_blank").focus();
+ const newWindow = window.open(href, "_blank");
+ newWindow.opener = null;
+ newWindow.focus();
// Hack to prevent changing current window.location.
// e.preventDefault() does not work.