-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warn about/prevent multiple direct remote connections #20834
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -338,6 +338,33 @@ import "./login.scss"; | |
event.stopPropagation(); | ||
} | ||
|
||
function deal_with_multihost() { | ||
// If we are currently logged in to some machine, but still | ||
// end up on the login page, we are about to load resources | ||
// from two machines into the same browser origin. | ||
|
||
const logged_into = environment["logged-into"]; | ||
const cur_machine = logged_into.length > 0 ? logged_into[0] : null; | ||
|
||
function redirect_to_current_machine() { | ||
if (cur_machine === ".") | ||
login_reload("/"); | ||
Comment on lines
+349
to
+351
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 3 added lines are not executed by any test. |
||
else | ||
login_reload("/=" + cur_machine); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This added line is not executed by any test. |
||
} | ||
|
||
if (cur_machine) { | ||
if (!environment.page.allow_multi_host) | ||
redirect_to_current_machine(); | ||
Comment on lines
+356
to
+358
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 3 added lines are not executed by any test. |
||
else { | ||
id("multihost-message").textContent = format(_("You are already connected to '$0' in this browser session. Connecting to other hosts will allow them to execute arbitrary code on each other. Please be careful."), | ||
cur_machine == "." ? "localhost" : cur_machine); | ||
id("multihost-get-me-there").addEventListener("click", redirect_to_current_machine); | ||
show('#multihost-warning'); | ||
Comment on lines
+360
to
+363
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 4 added lines are not executed by any test. |
||
} | ||
} | ||
} | ||
|
||
function boot() { | ||
window.onload = null; | ||
|
||
|
@@ -348,6 +375,8 @@ import "./login.scss"; | |
document.documentElement.dir = window.cockpit_po[""]["language-direction"]; | ||
} | ||
|
||
deal_with_multihost(); | ||
|
||
setup_path_globals(window.location.pathname); | ||
|
||
/* Determine if we are nested or not, and switch styles */ | ||
|
@@ -948,6 +977,8 @@ import "./login.scss"; | |
} | ||
|
||
function login_reload (wanted) { | ||
console.log("RELOAD", wanted); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This added line is not executed by any test. |
||
|
||
// Force a reload if not triggered below | ||
// because only the hash part of the url | ||
// changed | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.