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

Refactor password logic to prevent accidental password leakage #708

Merged
merged 1 commit into from
Dec 11, 2019

Conversation

pspeter
Copy link
Contributor

@pspeter pspeter commented Nov 2, 2019

Stacked on #706 and #705, merge those before merging this PR. I can also rebase on master afterwards before merging to avoid duplicate commits.

After working with the passwords a bit in #706, I noticed how they were sometimes stored in the same dict as all the other journal specific configuration. I also noticed how some of the test files even had password fields in them.

I was worried that real passwords would accidentally get written to the jrnl config file in the future (and subsequently leaked through peoples dotfile repositories...). To prevent that, I refactored a lot of the code to constrict the password handling logic only to the EncryptedJournal classes and away from the other configuration that gets saved to disk.

However, I had to change the install progress a little bit to make this work. It will now not ask you for a password right away but rather if you want to encrypt or not. Only if you reply 'y' will it ask you for the password later on.

Currently this still breaks the install, which we do not have tests for by the way.

Checklist

  • The code change is tested and works locally.
  • Tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?

@pspeter pspeter force-pushed the simplify-password-logic branch 2 times, most recently from 64034a4 to 22caa89 Compare November 2, 2019 01:37
@wren wren self-assigned this Nov 6, 2019
@wren wren added the enhancement New feature or request label Nov 6, 2019
@pspeter pspeter mentioned this pull request Nov 8, 2019
7 tasks
@wren wren added this to the v2.1.1 - Doctor's Orders milestone Nov 9, 2019
jrnl/util.py Outdated Show resolved Hide resolved
@pspeter pspeter force-pushed the simplify-password-logic branch 4 times, most recently from 0ef9444 to 4f4ed80 Compare November 12, 2019 12:51
@wren wren changed the base branch from master to develop November 26, 2019 04:45
@pspeter pspeter force-pushed the simplify-password-logic branch 2 times, most recently from 02d6c5d to 421c1a4 Compare November 29, 2019 15:00
This commit should greatly simplify all password handling logic. No passwords are stored in the config dict anymore. Only the Encrypted Journals have any password related logic. I also had to remove some password fields from the test files, which shows how dangerous the previous approach was. A slight code change could've leaked passwords to the config file. However, I had to change the install progress a little bit to make this work. It will now not ask you for a password right away but rather if you want to encrypt or not. Only if you reply 'y' will it ask you for the password later on.
@pspeter pspeter force-pushed the simplify-password-logic branch from 421c1a4 to 444d6de Compare November 29, 2019 16:07
Copy link
Member

@wren wren left a comment

Choose a reason for hiding this comment

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

Looks great. Thank you! 🥇

@wren wren merged commit a9e4e09 into jrnl-org:develop Dec 11, 2019
@wren wren changed the title [Stacked on #706] Refactor password logic to prevent accidental password leakage Refactor password logic to prevent accidental password leakage Jan 10, 2020
@lock
Copy link

lock bot commented May 21, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the 🔒 Outdated label May 21, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request 🔒 Outdated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants