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

"should become root" saving logic not right on fedora-coreos #20262

Open
allisonkarlitskaya opened this issue Apr 4, 2024 · 1 comment
Open
Labels

Comments

@allisonkarlitskaya
Copy link
Member

When investigating an issue that only occurs on ostree-based images we noticed that logging in as admin, logging out, then logging in as a non-privileged user ("scruffy") is enough to trigger the issue, which is caused by a pending sudo operation. Removing the "admin" login part and the problem disappears.

My theory is that the login page is somehow changing its local storage behaviour of remember the "should be root" flag for the case where we are using the -ws container to connect to the host via ssh.

cc @jelly

@jelly
Copy link
Member

jelly commented Apr 4, 2024

So digging into the test (TestUser.testExpire) it does:

        b.logout()
        self.login_and_go("/users", user="scruffy")
        b.go("#/scruffy")

So we could add a check that the bridge was really closed on b.logout or we can read what login_and_go does:

    def login_and_go(self, path: Optional[str] = None, user: Optional[str] = None, host: Optional[str] = None,
                     superuser: bool = True, urlroot: Optional[str] = None, tls: bool = False, password: Optional[str] = None,
                     legacy_authorized: Optional[bool] = None):

        self.try_login(user, password, superuser=superuser, legacy_authorized=legacy_authorized)

So by default we try to login as superuser in try_login:

        if superuser is not None:
            self.eval_js('window.localStorage.setItem("superuser:%s", "%s");' % (user, "any" if superuser else "none"))

If I change the test to superuser=False it seems to pass! Verified via:

-> window.localStorage.setItem("superuser:scruffy", "any");
<- {'type': 'undefined'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants