Skip to content

KeePass2Reader: fix error message logic#2523

Merged
droidmonkey merged 1 commit intokeepassxreboot:developfrom
c4rlo:keepass2-fix-errmsg
Dec 2, 2018
Merged

KeePass2Reader: fix error message logic#2523
droidmonkey merged 1 commit intokeepassxreboot:developfrom
c4rlo:keepass2-fix-errmsg

Conversation

@c4rlo
Copy link
Copy Markdown
Contributor

@c4rlo c4rlo commented Dec 1, 2018

Bug found via lgtm.com.

Type of change

  • ✅ Bug fix (non-breaking change which fixes an issue)

Description and Context

Fix error message when attempting to open a KeePass 1 database.

While I was at it, I also introduced a dedicated error message for I/O errors when attempting to read the file signature (though this is secondary and doesn't matter much).

Testing strategy

make test continues to pass.

Other than that, I've tested this manually, by attempting to open files /dev/null, CHANGELOG, and tests/data/basic.kdb.

Before my change

The error message in all three cases is:

Unable to open the database:
Error while reading the database: Not a KeePass database.

After my change

For /dev/null:

Unable to open the database:
Error while reading the database: Failed to read database file.

For CHANGELOG:

Unable to open the database:
Error while reading the database: Not a KeePass database.

For tests/data/basic.kdb:

Unable to open the database:
Error while reading the database: The selected file is an old KeePass 1 database (.kdb).

You can import it by clicking on Database > 'Import KeePass 1 database...'.
This is a one-way migration. You won't be able to open the imported database with the old KeePassX 0.4 version.

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]
  • ✅ I have compiled and verified my code with -DWITH_ASAN=ON. [REQUIRED]

@droidmonkey
Copy link
Copy Markdown
Member

Can you create a database that matches the signature1/signature2 conditions to elicit the import error message?

@c4rlo
Copy link
Copy Markdown
Contributor Author

c4rlo commented Dec 1, 2018

Like my comment says above, tests/data/basic.kdb is such a database.

@droidmonkey
Copy link
Copy Markdown
Member

I need to get my (non-existent) glasses checked! I glossed right over that last part of your PR.

@droidmonkey droidmonkey requested a review from phoerious December 1, 2018 19:08
@phoerious
Copy link
Copy Markdown
Member

Wait the tests did pass before... Shouldn't they have failed of this is an issue?

@droidmonkey
Copy link
Copy Markdown
Member

I think the issue is that the specific error message about being a KeePass1 database that must be imported was not being displayed. The parser correctly failed, just did not display the right error for the human.

@c4rlo
Copy link
Copy Markdown
Contributor Author

c4rlo commented Dec 2, 2018

That's correct.

@phoerious
Copy link
Copy Markdown
Member

I see. Go on then.

@droidmonkey droidmonkey merged commit b6eeaba into keepassxreboot:develop Dec 2, 2018
sebastianlivoni added a commit to sebastianlivoni/keepassxc that referenced this pull request Jun 7, 2025
…9f734c..7943959d7

7943959d7 Merge pull request keepassxreboot#1 from sebastianlivoni/develop
42ba9be92 Merge branch 'feature/safari' into develop
003feb7c5 Merge pull request keepassxreboot#2571 from keepassxreboot/fix/check_input_width_with_segmented_totp
633fd4bf0 Merge pull request keepassxreboot#2574 from keepassxreboot/fix/atlassian_password_input
606e35762 Fix detecting Atlassian password input
eb9285212 Fix checking input width with segmented TOTP fields
dac9cecef Merge pull request keepassxreboot#2566 from keepassxreboot/fix/query_form_on_savedform_check
6b427faf3 Query form on savedForms check
54f5fe616 Merge pull request keepassxreboot#2560 from keepassxreboot/fix/update_issue_template
cda5ee592 Merge pull request keepassxreboot#2553 from keepassxreboot/fix/styling_improvements
8c42d7fce Add some more space between options
2c639749c Styling improvements
951557d50 Merge pull request keepassxreboot#2548 from joetor5/html-id
4be2b176c Fix browser integration doc link id
86c17bf04 Merge pull request keepassxreboot#2542 from keepassxreboot/fix/chatgpt_submit_button
8e4b866f4 Add submit button exception for OpenAI login page
a2748198b Merge pull request keepassxreboot#2525 from keepassxreboot/fix/credential_banner_improvement
064d27bf0 Improve username input detection with Credential Banner
dccf307e0 Merge pull request keepassxreboot#2524 from keepassxreboot/feature/add_support_for_firefox_shortcuts_page
c282d11ac Add support for opening Firefox shortcut settings page
5a6d37acf Merge pull request keepassxreboot#2523 from keepassxreboot/fix/get_credentials_from_different_db
7839dfe09 Fix retrieving credentials from changed DB in unlock dialog
25e1b2745 Merge pull request keepassxreboot#2522 from keepassxreboot/update_to_198
2bf48c680 Update to 1.9.8
0de621f0d Merge pull request keepassxreboot#2510 from keepassxreboot/fix/page_id_checks
d5063a6cf Fixes for page object checks and context menu item creation
a8297aeb5 Merge pull request keepassxreboot#2500 from keepassxreboot/fix/disable_passkeys_if_site_is_ignored
a5e7444f3 Merge pull request keepassxreboot#2521 from keepassxreboot/feature/support_autocomplete_username
f19c90cc0 Add support for autocomplete=username
e11d63df5 Disable passkeys script injection if site is ignored

git-subtree-dir: src/safariwebextension/keepassxc-browser
git-subtree-split: 7943959d7bb61a900f900b0a633778ea2acefa83
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.

3 participants