Skip to content
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

Closed

Conversation

mvollmer
Copy link
Member

@mvollmer mvollmer commented Aug 2, 2024

Demo: https://youtu.be/lvR2youiY4M

  • don't rely on logout resetting local storage. instead, let cockpit-ws report host addresses of valid cookies to login.html
  • config option
  • design
  • tests
  • coverage

@mvollmer mvollmer requested a review from garrett August 2, 2024 14:39
by finding the current session and redirecting to it from the login
page.
// 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;
Copy link
Contributor

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.

Comment on lines +349 to +351
function redirect_to_current_machine() {
if (cur_machine === ".")
login_reload("/");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 3 added lines are not executed by any test.

if (cur_machine === ".")
login_reload("/");
else
login_reload("/=" + cur_machine);
Copy link
Contributor

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.

Comment on lines +356 to +358
if (cur_machine) {
if (!environment.page.allow_multi_host)
redirect_to_current_machine();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 3 added lines are not executed by any test.

Comment on lines +360 to +363
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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 4 added lines are not executed by any test.

@@ -948,6 +977,8 @@
}

function login_reload (wanted) {
console.log("RELOAD", wanted);
Copy link
Contributor

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.

@mvollmer
Copy link
Member Author

mvollmer commented Aug 9, 2024

Let's split this. Preventing: #20860, warning: #20861.

@mvollmer mvollmer closed this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants