2

Scenario:

Alice uses my website on her own computer and sometimes also on a computer that Mallory also has access to. Alice likes using the password manager built in to the browser. She is aware that she needs to be more careful on computers that others also use.

Is there a way that I can provide a button to forget Alice's login details after she has finished (both username and password)? If she doesn't do this, Mallory has the ability to retrieve her login details.

There are thousands of Alices using my website, so I'm going to assume that trying to educate them all is a losing battle. I'm looking for a solution that works with human behaviour, not against it.

5
  • Is Mallory's machine treated as trusted while the user logs in (no keylogger etc.)?
    – jrtapsell
    Commented Jun 17, 2018 at 2:03
  • @jrtapsell Yes, Mallory is the user, not the machine. Let's say Mallory has access only after Alice has used it.
    – CJ Dennis
    Commented Jun 17, 2018 at 5:22
  • I think that you're looking for what websites do when you select "trusted device"? Commented Jun 17, 2018 at 5:23
  • 3
    Is it about a password manager or about active sessions? Password managers have a clear delete function in common browsers.
    – allo
    Commented Jul 17, 2018 at 11:34
  • 1
    It's better to not save the password at all, than to provide a "Forget the password" functionality and counting on users properly using it.
    – ThoriumBR
    Commented Aug 5, 2020 at 15:14

2 Answers 2

1

If I'm not mistaken, the browser only saves the information if it is there when either the AJAX request is sent or the page changes.

Now I'm going to get slightly technical given that this isn't StackOverflow, but I won't go into too many details as you should post it there if you have code related questions, but given what you want the process could go like this for a state handling library like React:

  1. the user presses submit.
  2. you delay the execution of the page change/login/ajax request.
  3. you save the information to some state (or a variable).
  4. you set the values of the boxes to generic "user" and "****".
  5. You send the request and log in the user.

I'm not exactly certain if this will work with every browser, but I have noticed that websites tend to do something similar quite often. I will admit that this is highly dependent on the browser, but it always will be and I honestly don't think that browsers are smart enough to know the difference, and if they are, just place the submit button outside of the form (if preventDefault doesn't do the trick first).

3
  • I don't think that would allow the browser to save the password on Alice's browser either. Alice wants the previous password automatically filled in unless she has deleted it.
    – CJ Dennis
    Commented Jun 17, 2018 at 5:24
  • see my above comment about how websites ask if it is a secure or public device. You would just submit directly if it were a secure device and avoid my provided steps with a simple conditional set by a checkbox if that is the case, or avoid the (imo insecure) browser storage altogether and use something like a jwt if it is a secure device. Commented Jun 17, 2018 at 5:30
  • basically you would avoid education and bring it down to a simple question about whether it is their device or someone else's/a public device. Commented Jun 17, 2018 at 5:31
1

A website certainly can't tell a browser to delete (or, indeed, to remember) any credential; that would be an enormous security flaw in the built-in password manager. If a user saves a password they didn't mean to save, the only option is to go into the password manager and manually delete it from there (or delete all saved passwords, but that would presumably upset the device's owner). Users can protect themselves in other ways, such as using a private/incognito browser session, but they have to remember to do that before logging in.

However, you can (probably) prevent the browser from offering to save the password in the first place by copying the HTML login form contents into JS variables and then clearing the HTML input elements, before submitting a scripted request containing the copied credentials using generic names for the values. You should obviously only do this if the user specifically indicates they don't want the credentials stored (e.g. by indicating that the machine is a shared device via a checkbox on the login form). I caveat this with "probably" because there's no standard around how password managers recognize login attempts, and a sufficiently clever one might be hard to fool (though it would probably also throw a lot of false positives).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .