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

Blank master password #410

Closed
wimgielis opened this issue Jan 3, 2025 · 9 comments
Closed

Blank master password #410

wimgielis opened this issue Jan 3, 2025 · 9 comments

Comments

@wimgielis
Copy link

Hello,

A how-to question. For some test Keepass databases, I have a master key but it is empty/blank.

How can I use pyKeepass in that case ?
I get: invalid credentials when I try with password = ""

When I change the password to test in Keepass and Python, it works fine.

Best regards,

Wim

@Evidlo
Copy link
Member

Evidlo commented Jan 3, 2025

Use None

@wimgielis
Copy link
Author

Hello,

Thanks, I already tried that. It gives me: Invalid credentials

Only changing it to "test" in the Python code and also in Keepass, then it works.

Visually in Keepass for the empty password, I get the checkbox with "Master password" and then leave that field blank and get access.

Thanks,

Wim

@PCavan
Copy link

PCavan commented Feb 27, 2025

I've just had the same issue and found a workaround:

class TruthyString(str):
    def __bool__(self):
        return True

kp = PyKeePass("path/to/keepass.kdbx", password=TruthyString())

I suspect that somewhere, there is a test like if password: that should instead be if password is not None:.

@Evidlo
Copy link
Member

Evidlo commented Feb 28, 2025

I'm not able to reproduce this, or I am misunderstanding your description. Here is a database with a keyfile but no password set, and I can open it with password=None.

Image

@PCavan
Copy link

PCavan commented Feb 28, 2025

It's not with a key file, it's with a password, but the password is the empty string.

@Evidlo
Copy link
Member

Evidlo commented Mar 3, 2025

I see where the problem is, but how are you entering an empty string in KeepassXC to verify this? KeepassXC seems to assume there is no password when the field is left empty.

@PCavan
Copy link

PCavan commented Mar 4, 2025

I'm not, we're using Keepass2.

@Evidlo
Copy link
Member

Evidlo commented Mar 4, 2025

This should be fixed in 4.1.1

@wimgielis
Copy link
Author

Hello,

I can confirm that it works now with a blank password for the database.
Many thanks !

Wim

@Evidlo Evidlo closed this as completed Mar 6, 2025
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

3 participants