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

Auto Filled Login Form Fails #521

Open
robbje opened this issue Oct 23, 2024 · 3 comments · May be fixed by #547
Open

Auto Filled Login Form Fails #521

robbje opened this issue Oct 23, 2024 · 3 comments · May be fixed by #547

Comments

@robbje
Copy link

robbje commented Oct 23, 2024

I deployed ziti controller in a k8s cluster and exposed Zac on some domain. I login with username and password and everything works fine. Then I log out and can't log in again (sometimes). I did some digging.

The ziti controller logs this message when I click on "LOGIN":

{"authMethod":"cert","file":"github.com/openziti/ziti/controller/model/authenticator_mod_cert.go:128","func":"github.com/openziti/ziti/controller/model.(*AuthModuleCert).Process","level":"error","msg":"no client certificates found","time":"2024-10-23T11:36:30.627Z"}

In the browser debug tools network tab I can see the outgoing POST requests
Working: POST authenticate?method=password with request content-length >0
Not working: POST authenticate?method=cert receives 401 and triggers above log line, request content-length: 0.

I confirmed with a debugger that I hit this code. username and password are indeed empty, despite being filled up in the web form. Hence it will use ?method=cert and no request body (can that actually ever work?).

It seems that this happens when the browser auto fills the input fields on site creation, these values are not reactively saved in the LoginComponent and default to their constructor values or are overwritten by them.

I'm running Controller: v1.1.9 ZAC: 3.4.3 and tried FF as well as Chrome.

When I try to manually edit the username and password field, say remove and add a letter, it works again. So I have my workaround, but others may have hit this issue, too. E.g. the screenshots in this issue show login failures with pre-filled (blue shaded) input fields.

@qrkourier
Copy link
Member

That's curious. Auto-filling somehow defeats the Javascript checking whether username and password are defined, and editing the auto-filled values restores the Javascript's ability to detect they are defined. I've encountered this problem when auto-filling my password in other apps. Sometimes, I get an input validation error complaining about a required field populated by my password manager that hadn't been "registered" for an unknown reason. I'll try to reproduce with a couple of password managers and browsers.

You tried Firefox and Chrome. Which password managers did you use to auto-fill, those built in to the web browser or an extension?

will use ?method=cert and no request body (can that actually ever work?)

Yes. You can log in with a client certificate to the console provided by the Ziti controller (as an option for the management API configuration). When you visit the console with a client certificate loaded in the web browser it should prompt you to select the certificate to present. After that's done you can click the login button with empty username/password and as you noted the Javascript will choose the cert authentication method, so there's a bug in how the Javascript detects that a password is present, or a bug in how the auto-filler registers that it populated a field, or some other endemic issue.

@robbje
Copy link
Author

robbje commented Oct 23, 2024

You tried Firefox and Chrome. Which password managers did you use to auto-fill, those built in to the web browser or an extension?

The builtin ones.

will use ?method=cert and no request body (can that actually ever work?)

Yes. You can log in with a client certificate to the console provided by the Ziti controller (as an option for the management API configuration). When you visit the console with a client certificate loaded in the web browser it should prompt you to select the certificate to present. After that's done you can click the login button with empty username/password and as you noted the Javascript will choose the cert authentication method, so there's a bug in how the Javascript detects that a password is present, or a bug in how the auto-filler registers that it populated a field, or some other endemic issue.

Ah, good to know, thanks for taking the time!

@qrkourier
Copy link
Member

I confirmed the reported problem with Firefox's built-in password manager. The auto-filled form's fields are evaluated as empty, so the function assumes cert auth since no password is detected.

@qrkourier qrkourier linked a pull request Nov 22, 2024 that will close this issue
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 a pull request may close this issue.

2 participants