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

Remote sync doesn't verify downloaded file #10910

Open
hifi opened this issue Jun 17, 2024 · 5 comments
Open

Remote sync doesn't verify downloaded file #10910

hifi opened this issue Jun 17, 2024 · 5 comments

Comments

@hifi
Copy link
Member

hifi commented Jun 17, 2024

Overview

At least when using the "Test" button the test is successful if the command succeeds and creates either a file or a directory.

Steps to Reproduce

  1. Make download command create a directory to {TEMP_DATABASE}
  2. Test is successful

Expected Behavior

The file must exist and have a KDBX header, no other result should be accepted. Testing against an empty remote will fail but that might be good as long as the error (stdout + stderr) is displayed.

Actual Behavior

An empty directory is accepted as a successful download or any file that isn't necessarily a database.

@hifi hifi added the bug label Jun 17, 2024
@droidmonkey
Copy link
Member

@t-h-e

@t-h-e
Copy link
Contributor

t-h-e commented Jun 17, 2024

Adding the check is easy. Can anyone tell me how to check the header though? Is there a method that does check for a kdbx header already?

@hifi
Copy link
Member Author

hifi commented Jun 17, 2024

KeePass2Reader::readDatabase reads the signature before reading the database. A small refactor to split that functionality out to a different method would allow using KeePass2Reader to just verify the signature and get the error if it fails.

The test could also just show a different success message if the command succeeds but no file is downloaded to indicate no errors happened but nothing was downloaded either.

@droidmonkey
Copy link
Member

droidmonkey commented Jun 17, 2024

We have a method to only read the public headers. That'll suffice.

https://github.com/keepassxreboot/keepassxc/blob/develop/src%2Fgui%2FDatabaseOpenWidget.cpp#L228

@t-h-e
Copy link
Contributor

t-h-e commented Jun 17, 2024

@droidmonkey thanks. I have added a check.
@hifi can you have a look?

See #10915

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

No branches or pull requests

4 participants