FreeTubeApp / FreeTube

An Open Source YouTube app for privacy
https://freetubeapp.io/
GNU Affero General Public License v3.0
13.08k stars 810 forks source link

[Feature Request]: Store hash of the settings password rather than settings password itself #4372

Closed MitchelPaulin closed 9 months ago

MitchelPaulin commented 9 months ago

Guidelines

Problem Description

Settings password is visible easily in plain text

image

The password should not be stored in plaintext, it should be hashed then stored

Proposed Solution

Hash the password using a secure algorithm and store the hash only

When the password is entered calculate the hash, then compare it

Alternatives Considered

You could encrypt all data https://github.com/FreeTubeApp/FreeTube/issues/3223

But this is at least a good start, even if you encrypt the whole directory you probably still want that password hashed.

Issue Labels

improvement to existing feature

Additional Information

No response

MitchelPaulin commented 9 months ago

I'd be willing to take a look at implementing this as well if its something that theres interest in adding it

absidue commented 9 months ago

Just to make it clear that password is purely for the settings, it should not be used for file encryption, if you want to do that you will need to create a separate one. Using a password that is clearly defined as only being used to restrict access to a section of the app, for suddenly encrypting the files on disk, is not what any user will want (that changes it from a parental control to a data loss hazard)

Hashing the settings password was discussed in the original pull request but was left until later, it wasn't considered vital for the initial implementation, so fell free to add it.

We definitely can't encrypt the whole directory, as most of the stuff that is in there are Electron files.

Encrypting the databases is going to be difficult too, as you would have to fork and maintain a copy of the database dependency, because it reads and writes the file itself, we don't do that. Would also make life difficult for the web build and the Cordova fork.

absidue commented 9 months ago

If you want to implement hashing the settings password, I would be okay with approving a pull request for that.

Side note: hashing the password would give you a false sense of security, anyone that knows enough to look at the files, can also just delete the password entry from the database and get rid of it entirely, but if you think it's still worth doing I won't stop you from adding it.

MitchelPaulin commented 9 months ago

Just to make it clear that password is purely for the settings, it should not be used for file encryption, if you want to do that you will need to create a separate one. Using a password that is clearly defined as only being used to restrict access to a section of the app, for suddenly encrypting the files on disk, is not what any user will want (that changes it from a parental control to a data loss hazard)

Hashing the settings password was discussed in the original pull request but was left until later, it wasn't considered vital for the initial implementation.

We definitely can't encrypt the whole directory, as most of the stuff that is in there are Electron files.

Encrypting the databases is going to be difficult too, as you would have to fork and maintain a copy of the database dependency, because it reads and writes the file itself, we don't do that. Would also make life difficult for the web build and the Cordova fork.

Yeah there was no plan to encrypt the whole db, just the password, of course this isn't entirely secure either as you can just edit the file yourself and remove the password or since its open source and you know the hashing algorithm, change it to a password you would like by calculating its hash, but at least this way it may not leak a password that someone may be using on multiple accounts.

efb4f5ff-1298-471a-8973-3d47447115dc commented 9 months ago

Isnt this a duplicat of https://github.com/FreeTubeApp/FreeTube/issues/3221 ?

MitchelPaulin commented 9 months ago

Duplicate of https://github.com/FreeTubeApp/FreeTube/issues/3221