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

CLI: Cleanup create options #4313

Merged
merged 3 commits into from
Mar 19, 2020

Conversation

louib
Copy link
Member

@louib louib commented Feb 11, 2020

Fixes #4307

This makes sure that there's no clash between the database opening options (--no-password and --key-file) and the database creation/modification options, which start by --set. The main consequence is that setting the password on creation must be done explicitly, but I feel like it's ok to be explicit when creating the db.

Type of change

  • ✅ Refactor (significant modification to existing code)
  • ✅ New feature (non-breaking change which adds functionality)
  • ✅ Breaking change (fix or feature that would cause existing functionality to change)
  • ✅ Documentation (non-code change)

Testing strategy

unit tests.

Checklist:

  • ✅ I have read the CONTRIBUTING document. [REQUIRED]
  • ✅ My code follows the code style of this project. [REQUIRED]
  • ✅ All new and existing tests passed. [REQUIRED]
  • ✅ My change requires a change to the documentation, and I have updated it accordingly.
  • ✅ I have added tests to cover my changes.

@louib louib force-pushed the cleanup_create_options branch from 678487a to 3c0e580 Compare February 11, 2020 16:17
@louib louib requested a review from a team February 11, 2020 17:17
src/cli/Create.cpp Show resolved Hide resolved
src/cli/Create.cpp Outdated Show resolved Hide resolved
@droidmonkey
Copy link
Member

If neither --set-password nor --set-keyfile are provided we should add a prompt to confirm that the user intends to create a database without any protection. This prompt would not show if the --quiet flag is set.

@droidmonkey droidmonkey added this to the v2.6.0 milestone Feb 16, 2020
@droidmonkey droidmonkey changed the title Cleanup create options CLI: Cleanup create options Feb 16, 2020
@louib
Copy link
Member Author

louib commented Feb 18, 2020

If neither --set-password nor --set-keyfile are provided we should add a prompt to confirm that the user intends to create a database without any protection. This prompt would not show if the --quiet flag is set.

Can we create a database without any protection from the GUI?

@louib louib force-pushed the cleanup_create_options branch from 3c0e580 to 8227044 Compare February 18, 2020 01:11
@louib louib requested a review from droidmonkey February 18, 2020 02:01
@droidmonkey
Copy link
Member

Yes you can, but it gives you a warning

@louib
Copy link
Member Author

louib commented Feb 24, 2020

@droidmonkey of course we could also preserve the current default of creating the db with a password. Not sure what is the best solution here.

@louib louib force-pushed the cleanup_create_options branch from 8eef999 to 8e440e3 Compare February 24, 2020 19:18
@droidmonkey
Copy link
Member

droidmonkey commented Feb 25, 2020

I'm confused, can't we just do:

if (!parser->isSet(Command::SetKeyFileOption) 
    && !parser->isSet(Command::SetPasswordOption) 
    && !parser->isSet(Command::NoCredentialsOption)) {

	err << QObject::tr("Cannot create database without any credentials. If this is what you intended to do, use --set-no-credentials.");
	return EXIT_FAILURE;
}

@louib
Copy link
Member Author

louib commented Feb 25, 2020

@droidmonkey yeah, we could 💯% do this.

@droidmonkey
Copy link
Member

@louib are you going to complete this PR?

@louib
Copy link
Member Author

louib commented Mar 10, 2020

@droidmonkey yes, I'm going to need a couple more weeks before I can jump back into it.

@droidmonkey
Copy link
Member

droidmonkey commented Mar 11, 2020

I can complete this one to get it off the books, otherwise it might not make 2.6

@droidmonkey
Copy link
Member

So you cannot create a database with no credentials in the GUI so I did not allow that behavior in CLI. I did, however, implement password repeat checks and the ability to create a database without a password. This applies to the import command as well.

@droidmonkey droidmonkey force-pushed the cleanup_create_options branch from 8e440e3 to d6dfebf Compare March 14, 2020 13:38
@louib
Copy link
Member Author

louib commented Mar 14, 2020

@droidmonkey so you decided not to implement a --no-credentials option? I don't mind the Y/N question, but I feel like it makes the process less suitable for scripting.

@droidmonkey
Copy link
Member

droidmonkey commented Mar 14, 2020

That is only for a blank password. It is no less scriptable than having to enter a password in the first place. It would be very niche to me to script database creation or importing from xml/csv.

* Add password repeat check
* Standardize process between `db-create` and `import` commands
* Improve db-create tests with new password repeat
@droidmonkey droidmonkey force-pushed the cleanup_create_options branch from d6dfebf to 3c9b13a Compare March 15, 2020 17:37
@droidmonkey droidmonkey merged commit e6c2c7e into keepassxreboot:develop Mar 19, 2020
@louib louib deleted the cleanup_create_options branch March 19, 2020 01:56
lerignoux pushed a commit to lerignoux/keepassxc that referenced this pull request May 28, 2020
* Add ability to create database with an empty password
* Add password repeat check
* Standardize process between `db-create` and `import` commands
* Improve db-create tests with new password repeat

Co-authored-by: Jonathan White <[email protected]>
droidmonkey added a commit that referenced this pull request Jul 7, 2020
Added

- Custom Light and Dark themes [#4110, #4769, #4791, #4796, #4892, #4915]
- Compact mode to use classic Group and Entry line height [#4910]
- View menu to quickly switch themes, compact mode, and toggle UI elements [#4910]
- Search for groups and scope search to matched groups [#4705]
- Save Database Backup feature [#4550]
- Sort entries by "natural order" and move lines up/down [#4357]
- Option to launch KeePassXC on system startup/login [#4675]
- Caps Lock warning on password input fields [#3646]
- Add "Size" column to entry view [#4588]
- Browser-like tab experience using Ctrl+[Num] (Alt+[Num] on Linux) [#4063, #4305]
- Password Generator: Define additional characters to choose from [#3876]
- Reports: Database password health check (offline) [#3993]
- Reports: HIBP online service to check for breached passwords [#4438]
- Auto-Type: DateTime placeholders [#4409]
- Browser: Show group name in results sent to browser extension [#4111]
- Browser: Ability to define a custom browser location (macOS and Linux only) [#4148]
- Browser: Ability to change root group UUID and inline edit connection ID [#4315, #4591]
- CLI: `db-info` command [#4231]
- CLI: Use wl-clipboard if xclip is not available (Linux) [#4323]
- CLI: Incorporate xclip into snap builds [#4697]
- SSH Agent: Key file path env substitution, SSH_AUTH_SOCK override, and connection test [#3769, #3801, #4545]
- SSH Agent: Context menu actions to add/remove keys [#4290]

Changed

- Complete replacement of default database icons [#4699]
- Complete replacement of application icons [#4066, #4161, #4203, #4411]
- Complete rewrite of documentation and manpages using Asciidoctor [#4937]
- Complete refactor of config files; separate between local and roaming [#4665]
- Complete refactor of browser integration and proxy code [#4680]
- Complete refactor of hardware key integration (YubiKey and OnlyKey) [#4584, #4843]
- Significantly improve performance when saving and opening databases [#4309, #4833]
- Remove read-only detection for database files [#4508]
- Overhaul of password fields and password generator [#4367]
- Replace instances of "Master Key" with "Database Credentials" [#4929]
- Change settings checkboxes to positive phrasing for consistency [#4715]
- Improve UX of using entry actions (focus fix) [#3893]
- Set expiration time to Now when enabling entry expiration [#4406]
- Always show "New Entry" in context menu [#4617]
- Issue warning before adding large attachments [#4651]
- Improve importing OPVault [#4630]
- Improve AutoOpen capability [#3901, #4752]
- Check for updates every 7 days even while still running [#4752]
- Improve Windows installer UI/UX [#4675]
- Improve config file handling of portable distribution [#4131, #4752]
- macOS: Hide dock icon when application is hidden to tray [#4782]
- Browser: Use unlock dialog to improve UX of opening a locked database [#3698]
- Browser: Improve database and entry settings experience [#4392, #4591]
- Browser: Improve confirm access dialog [#2143, #4660]
- KeeShare: Improve monitoring file changes of shares [#4720]
- CLI: Rename `create` command to `db-create` [#4231]
- CLI: Cleanup `db-create` options (`--set-key-file` and `--set-password`) [#4313]
- CLI: Use stderr for help text and password prompts [#4086, #4623]
- FdoSecrets: Display existing secret service process [#4128]

Fixed

- Fix changing focus around the main window using tab key [#4641]
- Fix search field clearing while still using the application [#4368]
- Improve search help widget displaying on macOS and Linux [#4236]
- Return keyboard focus after editing an entry [#4287]
- Reset database path after failed "Save As" [#4526]
- Use SHA256 Digest for Windows code signing [#4129]
- Improve handling of ccache when building [#4104, #4335]
- macOS: Properly re-hide application window after browser integration and Auto-Type usage [#4909]
- Auto-Type: Fix crash when performing on new entry [#4132]
- Browser: Send legacy HTTP settings to recycle bin [#4589]
- Browser: Fix merging browser keys [#4685]
- CLI: Fix encoding when exporting database [#3921]
- SSH Agent: Improve reliability and underlying code [#3833, #4256, #4549, #4595]
- FdoSecrets: Fix crash when editing settings before service is enabled [#4332]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CLI] create does not honor --no-password
2 participants