Skip to content

Store character's login passwords securely#3018

Merged
vadi2 merged 15 commits intoMudlet:developmentfrom
vadi2:add-secure-password-storage
Sep 9, 2019
Merged

Store character's login passwords securely#3018
vadi2 merged 15 commits intoMudlet:developmentfrom
vadi2:add-secure-password-storage

Conversation

@vadi2
Copy link
Copy Markdown
Member

@vadi2 vadi2 commented Aug 23, 2019

Brief overview of PR changes/additions

Store character's login passwords securely (the ones in the connection screen).

Motivation for adding to Mudlet

While it's very unlikely that a hacker who gets access to someone's machine will specifically go after their MUD characters password - there are many more valuable things to go after - it's still a good idea!

How can I tell if it works?

  1. the password field in Mudlets connection window should still have your password
  2. the password file in your profile's directory should be gone
  3. your OS's credential manager should list the passwords instead:

image

Other info (issues closed, discussion etc)

Close #1917.

Note that once you use this test version of Mudlet which migrates passwords to secure storage - normal Mudlet which doesn't have support for secured passwords, obviously, won't be able to read them. Keep this in mind: if you notice your password has "disappeared", you probably used this test version which secured your password and now you're back on the normal version which can't access it.

@vadi2 vadi2 added this to the 4.1.0 milestone Aug 23, 2019
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Aug 23, 2019

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@vadi2 vadi2 force-pushed the add-secure-password-storage branch from 5b9bdfa to 0cfafeb Compare August 24, 2019 14:52
#include "post_guard.h"
#include <QSettings>
#include <sstream>
#include <../3rdparty/qtkeychain/keychain.h>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This looks like an odd include, but that was the only way I could get it to work for both qmake and cmake.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It has to be a system include and not a local one (using "...") - strange?

@vadi2 vadi2 marked this pull request as ready for review August 27, 2019 12:55
@vadi2 vadi2 requested a review from a team as a code owner August 27, 2019 12:55
@vadi2 vadi2 requested review from a team August 27, 2019 12:55
@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Aug 28, 2019

When you rename the profile, I think the password will be 'forgotten' because it'll still be stored against the old profile - need to fix that.

@SlySven
Copy link
Copy Markdown
Member

SlySven commented Sep 1, 2019

Note that once you use this test version of Mudlet which migrates passwords to secure storage - normal Mudlet which doesn't have support for secured passwords, obviously, won't be able to read them. Keep this in mind: if you notice your password has "disappeared", you probably used this test version which secured your password and now you're back on the normal version which can't access it.

This could be problematic for testers - or those who have a lot of profiles and do not remember their passwords themselves - as we do not provide a means to sneak-a-peek at the existing password and destroying the user's existing password storage so other (current/prior) versions have no means of accessing them in a backward compatible manner is not going to be universally welcomed. I would like to see this being phased in over two patch (monthly) versions so that there is ONE version that reads the new encrypted version but also writes any modified ones or new profile ones to the existing storage system as well - then the FOLLOWING release removes the storage by the existing means - and the password storage becomes more secure at THAT release. I admit that this will take longer to introduce but it will prevent short term issues during the change-over.

Alternatively, we must add a facility to temporarily reveal the password on demand in the password entry box...

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Sep 1, 2019

@SlySven I agree with your concern, let's go with the former "slow migration" option. Passwords aren't deleted from the insecure storage right away now.

@SlySven
Copy link
Copy Markdown
Member

SlySven commented Sep 1, 2019

Ah, I had another thought recently - I share (some) of my profiles with (now) 3 OSes on the same machine (FreeBSD, Linux and Windows) however this secure storage is OS dependent - as I see it the Window's one is not going to be visible to the Linux one and visa-versa. Fair enough this is not a normal setup - but the same principle will apply when we get the portable mode fully operable - if the user plops their profiles onto a USB stick to play on more than one PC/OS how will the secure password storage work in that situation? 😟

@SlySven
Copy link
Copy Markdown
Member

SlySven commented Sep 1, 2019

📜 The QtKeyChain is an licensed project (though I am not clear whether it is the 2 or 3 clause BSD license - see frankosterfeld/qtkeychain#147) so we will need a suitable block in the "About Mudlet" - "Third Party" dialogue for it.

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Sep 2, 2019

@SlySven I tried to do it, but the way the license text is built up is super complicated. Would you mind adding it?

@SlySven
Copy link
Copy Markdown
Member

SlySven commented Sep 2, 2019

Humm, the library comes with 3 translations for about 33 strings:

  • Romanian qtkeychain_ro.ts
  • German qtkeychain_de.ts
  • Traditional Chinese (so Taiwanese, ROC) qtkeychain_zh.ts

We may need to generate (and pass upstream):

  • Russian
  • Spanish
  • French
  • Italian
  • Polish
  • Portugese
  • Simplified Chinese (Mainland/PRC)

I think we can skip, for the moment:

  • Greece
  • Dutch

and I will need to revise the translation loading code to also load in these translation files.

@SlySven
Copy link
Copy Markdown
Member

SlySven commented Sep 3, 2019

@ SlySven I tried to do it, but the way the license text is built up is super complicated. Would you mind adding it?

It is in vadi2#17 ...

Having tried this out I think having the ability to temporarily show the password in the entry box is not so out of the window after all - I had to scrabble around to find a utility (kwalletmanager) to inspect the securely stored data and such things aren't necessarily going to be on every user's Desktop. Therefore an in-app method is not that unreasonable IMVHO. I just need to reboot into Linux, pull it off the shelf and prepare a PR for it - but it is getting late so that will not be today...

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Sep 3, 2019

It is on Windows and macOS, and it's on my Ubuntu desktop as well... I think the amount of people you're looking at is very small. But OK, let's see what you've got!

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Sep 3, 2019

Humm, the library comes with 3 translations for about 33 strings:

We don't need those translations as users don't see them. Right now from the users point of view, the interface is unchanged (which is great!).

I have use the 2-Clause BSD (a.k.a the FreeBSD) licence that is in the
upstream's "COPYING" file - this is at varience with the two README files
which quote the licence as being the Modified BSD which is the 3-Clause
one. I have an open issue on the upstream repository seeking clarification;
should things not be as they seem it should be a relatively painless
operation to select the other boillerplate for this item.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven
Copy link
Copy Markdown
Member

SlySven commented Sep 4, 2019

But OK, let's see what you've got!

See above... 😆

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Sep 4, 2019

Cool! Anything left on this specific PR?

@vadi2 vadi2 modified the milestones: 4.1.0, 4.2.0 Sep 8, 2019
Copy link
Copy Markdown
Member

@SlySven SlySven left a comment

Choose a reason for hiding this comment

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

I think this can go in now - and then there can be a follow-up in the next release cycle to - under user control (so they can keep the old, insecure method for special cases - sharing profiles across OSes or on USB/dropbox) have the (application-wide) option to disable/delete the old direct to file (or an INI replacement) based storage system which will be enabled (i.e. nuke the insecure means) by default...

@SlySven SlySven assigned vadi2 and keneanung and unassigned SlySven Sep 8, 2019
@vadi2 vadi2 merged commit f02b621 into Mudlet:development Sep 9, 2019
@vadi2 vadi2 deleted the add-secure-password-storage branch September 9, 2019 05:37
vadi2 added a commit that referenced this pull request Sep 10, 2019
* Added QtKeychain

* Wire in QtKeychain into qmake build

* Install libsecret-dev in Travis

* Got read/write working from the secure storage only

* Reset password

* Change to using a callback instead of a deep chain of nested calls

* Wire in CMake build, but doesn't work yet

* Finish CMake build, works now

* WIP

* Add migration to secure storage

* Remove left-in debug echo

* Don't forget password when profile is renamed

* Don't delete passwords upon migration for now

* Revise: insert QtKeyChain licence boilerplate (#17)

I have use the 2-Clause BSD (a.k.a the FreeBSD) licence that is in the
upstream's "COPYING" file - this is at varience with the two README files
which quote the licence as being the Modified BSD which is the 3-Clause
one. I have an open issue on the upstream repository seeking clarification;
should things not be as they seem it should be a relatively painless
operation to select the other boillerplate for this item.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
dicene pushed a commit to dicene/Mudlet that referenced this pull request Feb 19, 2020
* Added QtKeychain

* Wire in QtKeychain into qmake build

* Install libsecret-dev in Travis

* Got read/write working from the secure storage only

* Reset password

* Change to using a callback instead of a deep chain of nested calls

* Wire in CMake build, but doesn't work yet

* Finish CMake build, works now

* WIP

* Add migration to secure storage

* Remove left-in debug echo

* Don't forget password when profile is renamed

* Don't delete passwords upon migration for now

* Revise: insert QtKeyChain licence boilerplate (Mudlet#17)

I have use the 2-Clause BSD (a.k.a the FreeBSD) licence that is in the
upstream's "COPYING" file - this is at varience with the two README files
which quote the licence as being the Modified BSD which is the 3-Clause
one. I have an open issue on the upstream repository seeking clarification;
should things not be as they seem it should be a relatively painless
operation to select the other boillerplate for this item.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@atari2600tim atari2600tim mentioned this pull request Dec 1, 2021
2 tasks
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.

Password file not encrypted

3 participants